D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
thread-self
/
root
/
home
/
shubmkcj
/
urbane.createerp.com
/
Filename :
print-purchase.php
back
Copy
<?php require_once ('vendor/autoload.php'); use \Statickidz\GoogleTranslate; $trans = new GoogleTranslate(); $source = 'en'; $target = 'zh'; require ('config.php'); $id = $_GET['id']; // php number function // function numberTowords($num) // { // $ones = array( // 0 =>"ZERO", // 1 => "ONE", // 2 => "TWO", // 3 => "THREE", // 4 => "FOUR", // 5 => "FIVE", // 6 => "SIX", // 7 => "SEVEN", // 8 => "EIGHT", // 9 => "NINE", // 10 => "TEN", // 11 => "ELEVEN", // 12 => "TWELVE", // 13 => "THIRTEEN", // 14 => "FOURTEEN", // 15 => "FIFTEEN", // 16 => "SIXTEEN", // 17 => "SEVENTEEN", // 18 => "EIGHTEEN", // 19 => "NINETEEN", // "014" => "FOURTEEN" // ); // $tens = array( // 0 => "ZERO", // 1 => "TEN", // 2 => "TWENTY", // 3 => "THIRTY", // 4 => "FORTY", // 5 => "FIFTY", // 6 => "SIXTY", // 7 => "SEVENTY", // 8 => "EIGHTY", // 9 => "NINETY" // ); // $hundreds = array( // "HUNDRED", // "THOUSAND", // "MILLION", // "BILLION", // "TRILLION", // "QUARDRILLION" // ); /*limit t quadrillion */ // $num = number_format($num,2,".",","); // $num_arr = explode(".",$num); // $wholenum = $num_arr[0]; // $decnum = $num_arr[1]; // $whole_arr = array_reverse(explode(",",$wholenum)); // krsort($whole_arr,1); // $rettxt = ""; // foreach($whole_arr as $key => $i){ // while(substr($i,0,1)=="0") // $i=substr($i,1,5); // if($i < 20){ // /* echo "getting:".$i; */ // $rettxt .= $ones[$i]; // }elseif($i < 100){ // if(substr($i,0,1)!="0") $rettxt .= $tens[substr($i,0,1)]; // if(substr($i,1,1)!="0") $rettxt .= " ".$ones[substr($i,1,1)]; // }else{ // if(substr($i,0,1)!="0") $rettxt .= $ones[substr($i,0,1)]." ".$hundreds[0]; // if(substr($i,1,1)!="0")$rettxt .= " ".$tens[substr($i,1,1)]; // if(substr($i,2,1)!="0")$rettxt .= " ".$ones[substr($i,2,1)]; // } // if($key > 0){ // $rettxt .= " ".$hundreds[$key]." "; // } // } // if($decnum > 0){ // $rettxt .= " and "; // if($decnum < 20){ // $rettxt .= $ones[$decnum]; // }elseif($decnum < 100){ // $rettxt .= $tens[substr($decnum,0,1)]; // $rettxt .= " ".$ones[substr($decnum,1,1)]; // } // } // return $rettxt; // } function numberTowords($num){ $decones = array( '01' => "One", '02' => "Two", '03' => "Three", '04' => "Four", '05' => "Five", '06' => "Six", '07' => "Seven", '08' => "Eight", '09' => "Nine", 10 => "Ten", 11 => "Eleven", 12 => "Twelve", 13 => "Thirteen", 14 => "Fourteen", 15 => "Fifteen", 16 => "Sixteen", 17 => "Seventeen", 18 => "Eighteen", 19 => "Nineteen" ); $ones = array( 0 => " ", 1 => "One", 2 => "Two", 3 => "Three", 4 => "Four", 5 => "Five", 6 => "Six", 7 => "Seven", 8 => "Eight", 9 => "Nine", 10 => "Ten", 11 => "Eleven", 12 => "Twelve", 13 => "Thirteen", 14 => "Fourteen", 15 => "Fifteen", 16 => "Sixteen", 17 => "Seventeen", 18 => "Eighteen", 19 => "Nineteen" ); $tens = array( 0 => "", 2 => "Twenty", 3 => "Thirty", 4 => "Forty", 5 => "Fifty", 6 => "Sixty", 7 => "Seventy", 8 => "Eighty", 9 => "Ninety" ); $hundreds = array( "Hundred", "Thousand", "Million", "Billion", "Trillion", "Quadrillion" ); //limit t quadrillion $num = number_format($num,2,".",","); $num_arr = explode(".",$num); $wholenum = $num_arr[0]; $decnum = $num_arr[1]; $whole_arr = array_reverse(explode(",",$wholenum)); krsort($whole_arr); $rettxt = ""; // foreach($whole_arr as $key => $i){ // if($i < 20){ // $rettxt .= $ones[$i]; // } // elseif($i < 100){ // // $rettxt .= $tens[substr($i,0,1)]; // // $rettxt .= " ".$ones[substr($i,1,1)]; // if(substr($i,0,1)!="0") $rettxt .= $tens[substr($i,0,1)]; // if(substr($i,1,1)!="0") $rettxt .= " ".$ones[substr($i,1,1)]; // } // else{ // $rettxt .= $ones[substr($i,0,1)]." ".$hundreds[0]; // $rettxt .= " ".$tens[substr($i,1,1)]; // $rettxt .= " ".$ones[substr($i,2,1)]; // } // if($key > 0){ // $rettxt .= " ".$hundreds[$key]." "; // } // } foreach($whole_arr as $key => $i){ while(substr($i,0,1)=="0") $i=substr($i,1,5); if($i < 20){ /* echo "getting:".$i; */ $rettxt .= $ones[$i]; }elseif($i < 100){ if(substr($i,0,1)!="0") $rettxt .= $tens[substr($i,0,1)]; if(substr($i,1,1)!="0") $rettxt .= " ".$ones[substr($i,1,1)]; }else{ if(substr($i,0,1)!="0") $rettxt .= $ones[substr($i,0,1)]." ".$hundreds[0]; if(substr($i,1,1)!="0")$rettxt .= " ".$tens[substr($i,1,1)]; if(substr($i,2,1)!="0")$rettxt .= " ".$ones[substr($i,2,1)]; } if($key > 0){ $rettxt .= " ".$hundreds[$key]." "; } } if($decnum > 0){ $rettxt .= " "; if($decnum < 20){ $rettxt = $rettxt." and "; $rettxt .= $decones[$decnum]; } elseif($decnum < 100){ $rettxt = $rettxt." and "; $rettxt .= $tens[substr($decnum,0,1)]; $rettxt .= " ".$ones[substr($decnum,1,1)]; } $rettxt = $rettxt. " Cents Only"; } else{ $rettxt = $rettxt. " Only"; } return $rettxt;} // company data fetch $companyd = mysqli_query($conn,"SELECT * FROM `company_details`"); $companyrow = mysqli_fetch_assoc($companyd); $company_name = $companyrow['company_name']; $company_logo = $companyrow['company_logo']; $GSTIN = $companyrow['GSTIN']; $contact_person = $companyrow['contact_person']; $phone = $companyrow['phone']; $company_email = $companyrow['email']; $address = $companyrow['address']; $city = $companyrow['city']; $state = $companyrow['state']; $country = $companyrow['country']; $account_name = $companyrow['account_name']; $account_no = $companyrow['account_no']; $bank_name = $companyrow['bank_name']; $ifsc = $companyrow['ifsc']; $shift = $companyrow['shift']; $branch = $companyrow['branch']; $company_color = $companyrow['company_color']; $invoice_prifix = $companyrow['invoice_prifix']; $default_invoice = $companyrow['default_invoice']; $signature = $companyrow['signature']; $invoice_note = $companyrow['invoice_note']; $companyId =""; $sql = " SELECT * FROM purchase_order where id = '$id'"; $result = mysqli_query($conn,$sql); $row = mysqli_fetch_array($result); $manufacturer_id = $row['manufacturer']; $po_id = $row['po_id']; $order_date = $row['order_date']; $proforma_id = $row['proforma_id']; $receive_info = $row['receive_info']; $delivery_address = $row['delivery_address']; $delivery_type = $row['delivery_type']; $delivery_terms = $row['delivery_terms']; $type = $row['type']; $payment_terms = $row['payment_terms']; $comment = $row['comment']; $subtotal_price = $row['subtotal_price']; $bank_charges = $row['bank_charges']; $amount_paind = $row['amount_paind']; $date_creation = $row['date_creation']; $revised_date = $row['revised_date']; if(!empty($revised_date)){ $rev_date="<p class='mb-0 font12'><strong>Revised Date</strong> : $revised_date</p>"; }else{ $rev_date=''; } $getitemsql = mysqli_query($conn,"SELECT * FROM po_item a left join inventory b on a.item_id = b.id where a.purchase_order_id = '$id'"); while($item_row = mysqli_fetch_assoc($getitemsql)){ $item_image = $item_row['item_image']; if(!empty($item_image)){ $if_image = '<img src="inventory/'.$item_image.'" width="20">'; }else{ $if_image = ''; } $ii_items .='<tr style="width:100%"> <td class="font12" style="padding:2px;width:10%"> '.$item_row['item_code'].' </td> <td class="font12" style="padding:2px;width:10%">'.$if_image.'</td> <td class="font12" style="padding:2px;width:20%"> '.$item_row['name'].' / '.$item_row['item_name_ch'].' </td> <td class="font12" style="padding:2px;width:10%"> '.$item_row['size'].'</td> <td class="font12" style="padding:2px;width:20%"> '.$item_row['color'].' / '.$item_row['item_color_ch'].'</td> <td class="font12" style="padding:2px;width:5%"> '.$item_row['qty'].'</td> <td class="font12" style="padding:2px;width:5%"> '.$item_row['unit_of_measure'].'</td> <td class="font12" style="padding:2px;width:10%"> '.$item_row['price'].'</td> <td class="font12" style="padding:2px;width:10%"> '.$item_row['row_total'].'</td> </tr>'; } $contactsql = mysqli_query($conn,"SELECT * FROM `manufacturer` where id='$manufacturer_id'"); $contactrow = mysqli_fetch_assoc($contactsql); $customer_type = $contactrow['customer_type']; $manufacturer_display_name = $contactrow['manufacturer_display_name']; $contact_person_name = $contactrow['contact_person_name']; $manu_phone = $contactrow['phone']; $manu_email = $contactrow['email']; $currency = $contactrow['currency']; $address_get = $contactrow['address'] .', '. $contactrow['city'] .', '. $contactrow['state'] .', '. $contactrow['country']; // purchanse orders name $contact_persona_po = 'Contact Person'; $html = "<!DOCTYPE html> <html> <body> <br> <section class='invoice-page'> <div class='container-fluid'> <div class='row'> <div class='col-md-6 float-left'> <p class='mb-0'><strong> $company_name </strong></p> <p class='mb-0 font12'> $address, $city, $state, $country</p> <p class='mb-0 font12'> $contact_persona_po : $contact_person</p> <p class='mb-0 font12'>Contact Number : $phone</p> <p class='mb-0 font12'>Email : $company_email</p> </div> <div class='col-md-6 float-right'> <img src='images/urbane.png'> <p style='display:block;background:#0B6465;text-align:center;color:#fff;font-size:16px !important;font-weight:bold;'> Purchase Order <p> </div> </div> <div class='row pt-1'> <div class='col-md-6 float-left'> <p><strong>Manufacturer :</strong></p> <p class='mb-0'><strong> ".ucfirst($manufacturer_display_name)." </strong></p> <p class='mb-0 font12' >Contact Person: $contact_person_name</p> <p class='mb-0 font12'>Contact No.: $manu_phone</p> <p class='mb-0 font12'>Contact Email: $manu_email</p> <div class='pt-3'> <p class='mb-0 font12'>SHIP TO :</p> <p class='mb-0'><strong>$company_name</strong></p> <p class='mb-0 font12'>$delivery_address</p> </div> </div> <div class='col-md-6 float-right'> <p class='mb-0 font12'><strong>Purchase Order No.</strong> : $po_id</p> <p class='mb-0 font12'><strong>Order Date</strong> : $order_date</p> $rev_date <p class='mb-0 font12'><strong>Proforma Id</strong> : $proforma_id</p> <div class='pt-3'> <p class='mb-0 font12'><strong>Delivery Terms</strong> : $delivery_terms</p> <p class='mb-0 font12'><strong>Delivery Type</strong> : $delivery_type</p> <p class='mb-0 font12'><strong>Payment Terms</strong> : $payment_terms</p> </div> </div> </div> <div class='row pt-3'> <table class='table'> <thead> <tr style='width:100%'> <th class='bac_color' style='background: #afafaf !important; color:#fff; padding:2px;'>Item Code</th> <th class='bac_color' style='background: #afafaf !important; color:#fff; padding:2px;'>Image</th> <th class='bac_color' style='background: #afafaf !important; color:#fff; padding:2px;'>Item Name</th> <th class='bac_color' style='background: #afafaf !important; color:#fff; padding:2px;'>Size</th> <th class='bac_color' style='background: #afafaf !important; color:#fff; padding:2px;'>Color</th> <th class='bac_color' style='background: #afafaf !important; color:#fff; padding:2px;'>Qty.</th> <th class='bac_color' style='background: #afafaf !important; color:#fff; padding:2px;'>Unit</th> <th class='bac_color' style='background: #afafaf !important; color:#fff; padding:2px;'>Price ($currency)</th> <th class='bac_color' style='background: #afafaf !important; color:#fff; padding:2px;'>Total ($currency)</th> </tr> </thead> <tbody> $ii_items </tbody> </table> <div> <hr> <div class='row pt-1'> <div class='col-md-6 float-left'> <p class='mb-0 font12'><strong> Sub Total </strong> : $subtotal_price ($currency)</p> <p class='mb-0 font12'><strong> Amount Paid </strong> : $amount_paind ($currency)</p> <hr> <p class='mb-0 font12'><b>Comment : </b> $comment</p> </div> <div class='col-md-6 float-right'> <p class='text-center m-0 font12'>For <strong>$company_name</strong><p> <p class='text-center'><img src='signature/$signature' width='95'></p> <p class='text-center'>Authorized Signatory</p> </div> </div> </div> </section> </body> </html>"; require ("mpdf/mpdf.php"); // $name = str_replace("#","",$invoice); //$mpdf = new mPDF('c', 'A4', '', '', 0, 0, 0, 0, 0, 0); $mpdf = new mPDF('A4'); $mpdf->allow_charset_conversion = true; $stylesheet = file_get_contents('bootstrap.min.css'); $mpdf->WriteHTML($stylesheet,1); $stylesheet1 = file_get_contents('styleInvoice3.css'); $mpdf->WriteHTML($stylesheet1,1); $mpdf->showImageErrors = true; $mpdf->SetDisplayMode('fullpage'); $mpdf->SetAutoFont(); $mpdf->useAdobeCJK = true; $mpdf->autoLangToFont = true; $mpdf->autoScriptToLang = true; $mpdf->WriteHTML($html); // error_reporting(E_ALL); // ob_end_clean(); // $mpdf->Output("qw.pdf","D"); $mpdf->Output(); exit; ?>