D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
thread-self
/
root
/
proc
/
thread-self
/
root
/
home
/
shubmkcj
/
urbane.createerp.com
/
Filename :
print-proforma.php
back
Copy
<?php 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 .= " ONLY "; // 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); $contact_person = $companyrow['contact_person']; $company_name = $companyrow['company_name']; $company_logo = $companyrow['company_logo']; $GSTIN = $companyrow['GSTIN']; $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']; // Invoice Data Fetch $sql = " SELECT * FROM proforma where id = '$id' and data_delete = 'NO'"; $result = mysqli_query($conn,$sql); $row = mysqli_fetch_array($result); $bill_pay_name = $row['bill_pay_name']; $proforma_id = $row['proforma_id']; $date = $row['date']; $terms = $row['terms']; $due_date = $row['due_date']; $billingAddress = $row['billingAddress']; $deliver_address = $row['deliver_address']; $client_name = $row['client_name']; $pincode = $row['pincode']; $mobile_no = $row['mobile_no']; $email = $row['email']; $gstin = $row['gstin']; $type = $row['type']; $buyer_reference = $row['buyer_reference']; $delivery_type = $row['delivery_type']; $delivery_terms = $row['delivery_terms']; $mode_of_shipment = $row['mode_of_shipment']; $shipping_date = $row['shipping_date']; $port_of_loading = $row['port_of_loading']; $port_of_delivery = $row['port_of_delivery']; $payment_method = $row['payment_method']; $hs_code = $row['hs_code']; $terms_of_payment = $row['terms_of_payment']; $bank_details = $row['bank_details']; $other_charges = $row['other_charges']; $other_price = $row['other_price']; $subtotal_price = $row['subtotal_price']; $amount_paid = $row['amount_paid']; $comment = $row['comment']; $bank_charges = $row['bank_charge']; $other_charge_msg = $row['other_charge_msg']; $revised_date = $row['revised_date']; // Other Charges Hae To $other_charges_h = ''; if(!empty($other_price)){ $other_charges_h = "<tr> <td class='py-0' style='padding:2px; width:10%'></td> <td class='py-0' style='padding:2px; width:10%'></td> <td class='py-0' style='padding:2px; width:20%'></td> <td class='py-0' style='padding:2px; width:10%'></td> <td class='py-0' style='padding:2px; width:15%'></td> <td class='py-0' style='padding:2px; width:5%'></td> <td class='py-0' style='padding:2px; width:5%'></td> <td class='font12 py-0' style='padding:2px; width:15%'><strong>Other <small>($other_charge_msg)<small></strong></td> <td class='font12 py-0' style='padding:2px; width:10%'>$other_price</td> </tr> "; } // Getting Contact Details $contactsql = mysqli_query($conn,"SELECT * FROM `contact` where id='$bill_pay_name' and data_delete !='yes'"); $contactrow = mysqli_fetch_assoc($contactsql); $customer_type = $contactrow['customer_type']; $bill_display_name = $contactrow['bill_display_name']; $contact_person_name = $contactrow['contact_person_name']; $contact_person_designation = $contactrow['contact_person_designation']; // billing address $getad_b = mysqli_query($conn,"SELECT * FROM `contact_address` where id='$billingAddress'"); $getadrow_b = mysqli_fetch_assoc($getad_b); $address_get_b = $getadrow_b['address'] .', '. $getadrow_b['city'] .', '. $getadrow_b['state'] .', '. $getadrow_b['country']; $iecno_b = $getadrow_b['iecno']; // getting address $getad = mysqli_query($conn,"SELECT * FROM `contact_address` where id='$deliver_address'"); $getadrow = mysqli_fetch_assoc($getad); $address_get = $getadrow['address'] .', '. $getadrow['city'] .', '. $getadrow['state'] .', '. $getadrow['country']; $iecno = $getadrow['iecno']; $currency = $companyrow['currency']; $getitemsql = mysqli_query($conn,"SELECT * FROM proforma_item a left join inventory b on a.item_id = b.id where a.proforma_id = '$proforma_id'"); while($item_row = mysqli_fetch_assoc($getitemsql)){ $item_image = $item_row['item_image']; // if(file_exists("inventory/'.$item_image.'")){ // if(!empty($item_image)){ // $if_image = '<img src="inventory/'.$item_image.'" width="20">'; // }else{ // $if_image = 'blank'; // } // }else{ // $if_image = 'not exist'; // } if (!empty($item_image)) { $image_path = "inventory/" . $item_image; if (file_exists($image_path)) { $if_image = '<img src="' . $image_path . '" width="20">'; } else { $if_image = ''; } } else { $if_image = ''; } $ii_items .='<tr style="width:100%"> <td class="font12 p-1" style="padding:2px;width:10%"> '.$item_row['item_code'].' </td> <td class="font12 p-1" style="padding:2px;width:10%">'.$if_image.'</td> <td class="font12 p-1" style="padding:2px;width:20%"> '.$item_row['name'].' </td> <td class="font12 p-1" style="padding:2px;width:10%"> '.$item_row['size'].'</td> <td class="font12 p-1" style="padding:2px;width:15%"> '.$item_row['color'].'</td> <td class="font12 p-1" style="padding:2px;width:10%"> '.$item_row['qty'].'</td> <td class="font12 p-1" style="padding:2px;width:5%"> '.$item_row['unit_of_measure'].'</td> <td class="font12 p-1" style="padding:2px;width:15%"> '.$item_row['price'].'</td> <td class="font12 p-1" style="padding:2px;width:10%"> '.$item_row['row_total'].'</td> </tr>'; } $html = "<!DOCTYPE html> <html lang='en'> <body> <section class='invoice-page'> <div class='container-fluid'> <div class='row'> <div class='col-md-6 float-left'> <p class='mb-0 font12'><b>SHIPPER :</b></p> <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 Person : $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;'>Proforma Invoice<p> </div> </div> <div class='row pt-1'> <div class='col-md-6 float-left'> <p class='mb-0 font12'><b>CONSIGNEE :</b></p> <p class='mb-0'> <strong>".ucfirst($bill_display_name)."</strong> </p> <p class='mb-0 font12'> $address_get_b </p> <p class='mb-0 font12'>Zip Code : $pincode </p> <p class='mb-0 font12'>GSTIN : $gstin</p> <p class='mb-0 font12'>IEC No.: $iecno </p> <p class='mb-0 font12'>Contact Person: $client_name</p> <p class='mb-0 font12'>Contact No.: $mobile_no</p> <div class='pt-3'> <p class='mb-0 font12'>SHIP TO :</p> <p class='mb-0'><strong>".ucfirst($bill_display_name)."</strong></p> <p class='mb-0 font12'>$address_get</p> </div> </div> <div class='col-md-6 float-right'> <p class='mb-0 font12'><strong>Proforma No.</strong> : $proforma_id</p> <p class='mb-0 font12'><strong>Proforma Date</strong> : $date</p> <p class='mb-0 font12'><strong>Revised Date</strong> : $revised_date</p> <p class='mb-0 font12'><strong>Buyer's Order No.</strong> : $buyer_reference</p> <p class='mb-0 font12'><strong>Comment</strong> : $comment </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 Method</strong> : $payment_method</p> <p class='mb-0 font12'><strong>Payment Terms</strong> : $terms_of_payment</p> <p class='mb-0 font12'><strong>Port Of Loading</strong> : $port_of_loading</p> <p class='mb-0 font12'><strong>Port Of Delivery</strong> : $port_of_delivery</p> <p class='mb-0 font12'><strong>Country Of Origin Of Goods</strong> : China</p> <p class='mb-0 font12'><strong>Country Of Final Destination</strong> : India</p> </div> </div> </div> <div class='row pt-3'> <table class='table'> <thead> <tr style='width:100%'> <th class='bac_color font12' style='background: #afafaf !important; color:#fff; padding:2px;'>Item Code</th> <th class='bac_color font12' style='background: #afafaf !important; color:#fff; padding:2px;'>Image</th> <th class='bac_color font12' style='background: #afafaf !important; color:#fff; padding:2px;'>Item Name</th> <th class='bac_color font12' style='background: #afafaf !important; color:#fff; padding:2px;'>Size</th> <th class='bac_color font12' style='background: #afafaf !important; color:#fff; padding:2px;'>Color</th> <th class='bac_color font12' style='background: #afafaf !important; color:#fff; padding:2px;'>Qty.</th> <th class='bac_color font12' style='background: #afafaf !important; color:#fff; padding:2px;'>Unit</th> <th class='bac_color font12' style='background: #afafaf !important; color:#fff; padding:2px;'>Price ($currency)</th> <th class='bac_color font12' style='background: #afafaf !important; color:#fff; padding:2px;'>Total ($currency)</th> </tr> </thead> <tbody> $ii_items $other_charges_h <tr> <td class='py-0' style='padding:2px;width:10%'></td> <td class='py-0' style='padding:2px;width:10%'></td> <td class='py-0' style='padding:2px;width:20%'></td> <td class='py-0' style='padding:2px;width:10%'></td> <td class='py-0' style='padding:2px;width:15%'></td> <td class='py-0' style='padding:2px;width:5%'></td> <td class='py-0' style='padding:2px;width:5%'></td> <td class='font12 py-0' style='padding:2px;width:15%'><strong>Sub Total</strong></td> <td class='font12 py-0' style='padding:2px; width:10%'>$subtotal_price</td> </tr> <tr> <td class='py-0' style='padding:2px; width:10%'></td> <td class='py-0' style='padding:2px;width:10%'></td> <td class='py-0' style='padding:2px;width:20%'></td> <td class='py-0' style='padding:2px; width:10%'></td> <td class='py-0' style='padding:2px;width:15%'></td> <td class='py-0' style='padding:2px;width:5%'></td> <td class='py-0' style='padding:2px;width:5%'></td> <td class='font12 py-0' style='padding:2px; width:15%'><strong>Bank Charges</strong></td> <td class='font12 py-0' style='padding:2px; width:10%'>$bank_charges</td> </tr> <tr> <td class='py-0' style='padding:2px; width:10%'></td> <td class='py-0' style='padding:2px;width:10%'></td> <td class='py-0' style='padding:2px;width:20%'></td> <td class='py-0' style='padding:2px;width:10%'></td> <td class='py-0' style='padding:2px;width:15%'></td> <td class='py-0' style='padding:2px;width:5%'></td> <td class='py-0' style='padding:2px;width:5%'></td> <td class='font12 py-0' style='padding:2px; width:15%'><strong>Amount Paid </strong><small>($currency)</small></td> <td class='font12 py-0' style='padding:2px; width:10%'>$amount_paid</td> </tr> </tbody> </table> <div class='col-md-12 p-0'> <p style='display:block;background:#afafaf;text-align:center;color:#fff;font-size:12px;'>Total Amount Chargeable in $currency - ".numberTowords("$amount_paid")."</p> </div> <div> <div class='row pt-4'> <div class='col-md-6 float-left'> <p class='mb-0 font12'><strong> BENEFICARY NAME : ".ucfirst($account_name)."</strong></p> <p class='mb-0 font12'>Bank A/C No. : $account_no</p> <p class='mb-0 font12'>Bank Name : $bank_name</p> <p class='mb-0 font12'>Swift Name : $shift</p> <p class='mb-0 font12'>Address : $branch</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 class='row mt-1'> <div class='col-md-12'> <p style='font-size:11px'><strong>Declaration</strong>: $invoice_note </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->WriteHTML($html); // error_reporting(E_ALL); // ob_end_clean(); // $mpdf->Output("qw.pdf","D"); $mpdf->Output(); exit; ?>