D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
thread-self
/
root
/
home
/
shubmkcj
/
urbane.createerp.com
/
Filename :
print_invoice_3.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 .= " and "; if($decnum < 20){ $rettxt .= $ones[$decnum]; }elseif($decnum < 100){ $rettxt .= $tens[substr($decnum,0,1)]; $rettxt .= " ".$ones[substr($decnum,1,1)]; } } 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']; $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']; $currency = $companyrow['currency']; $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']; $deliver_address = $row['deliver_address']; $client_name = $row['client_name']; $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']; $foreign_charges = $row['foreign_charges']; $foreign_rate = $row['foreign_rate']; $discount_percent = $row['discount_percent']; $discount = $row['discount']; $other_charges = $row['other_charges']; $memo = $row['memo']; $other_price = $row['other_price']; $subtotal_price = $row['subtotal_price']; $foreign_price = $row['foreign_price']; $discount_price = $row['discount_price']; $amount_paid = $row['amount_paid']; $comment = $row['comment']; // 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']; // 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']; $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($item_image != ''){ $ii_items .=' <tr style="width:100%"> <td class="font12" style="width:5%"><img src="inventory/'.$item_image.'" width="20"></td> <td class="font12" style="width:5%"> '.$item_row['name'].' </td> <td class="font12" style="width:10%"> '.$item_row['item_code'].' </td> <td class="font12" style="width:5%"> '.$item_row['color'].'</td> <td class="font12" style="width:5%"> '.$item_row['unit_of_measure'].'</td> <td class="font12" style="width:10%"> '.$item_row['size'].'</td> <td class="font12" style="width:5%"> '.$item_row['qty'].'</td> <td class="font12" style="width:10%"> '.$item_row['price'].'</td> <td class="font12" style="width:10%"> '.$item_row['row_total'].'</td> </tr>'; } } $html = "<!DOCTYPE html> <html lang='en'> <body> <br> <section class='invoice-page'> <div class='container-fluid'> <div class='row'> <div class='col-md-6 float-left'> <p><b>SHIPPER :</b></p> <h3 class='mb-0'>$company_name</h3> <p class='mb-0 font12'> $address, $city, $state, $country</p> <p class='mb-0 font12'>Contact Person : Gurmeet Singh</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;>Proforma Invoice<p> </div> </div> <div class='row pt-3'> <div class='col-md-6 float-left'> <p><b>CONSIGNEE :</b></p> <h4 class='mb-0'> $bill_display_name </h4> <p class='mb-0 font12'> $address_get </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: $contact_person_name</p> <p class='mb-0 font12'>Contact No.: $mobile_no</p> <div class='pt-3'> <p><b>SHIP TO :</b></p> <p>$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>Buyer's Order</strong> : $buyer_reference</p> <div class='pt-3'> <p class='mb-0 font12'><strong>Delivery Terms</strong> : $delivery_terms</p> <p class='mb-0 font12'><strong>Due date</strong> : $delivery_type</p> <p class='mb-0 font12'><strong>Delivery Type</strong> : $delivery_type</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' style='background: #afafaf !important; color:#fff;'>Image</th> <th class='bac_color' style='background: #afafaf !important; color:#fff;'>Item Name</th> <th class='bac_color' style='background: #afafaf !important; color:#fff;'>Item Code</th> <th class='bac_color' style='background: #afafaf !important; color:#fff;'>Color</th> <th class='bac_color' style='background: #afafaf !important; color:#fff;'>Unit</th> <th class='bac_color' style='background: #afafaf !important; color:#fff;'>Size</th> <th class='bac_color' style='background: #afafaf !important; color:#fff;'>Qty.</th> <th class='bac_color' style='background: #afafaf !important; color:#fff;'>Rate (USD)</th> <th class='bac_color' style='background: #afafaf !important; color:#fff;'>Total (USD)</th> </tr> </thead> <tbody> $ii_items <tr> <td class='py-0'></td> <td class='py-0'></td> <td class='py-0'></td> <td class='py-0'></td> <td class='py-0'></td> <td class='py-0'></td> <td class='py-0'></td> <td class='font12 py-0'><strong>Other</strong></td> <td class='font12 py-0'>$other_price</td> </tr> <tr> <td class='py-0'></td> <td class='py-0'></td> <td class='py-0'></td> <td class='py-0'></td> <td class='py-0'></td> <td class='py-0'></td> <td class='py-0'></td> <td class='font12 py-0'><strong> Freight</strong></td> <td class='font12 py-0'>$subtotal_price</td> </tr> <tr> <td class='py-0'></td> <td class='py-0'></td> <td class='py-0'></td> <td class='py-0'></td> <td class='py-0'></td> <td class='py-0'></td> <td class='py-0'></td> <td class='font12 py-0'><strong>Discount</strong></td> <td class='font12 py-0'>$foreign_price</td> </tr> <tr> <td class='py-0'></td> <td class='py-0'></td> <td class='py-0'></td> <td class='py-0'></td> <td class='py-0'></td> <td class='py-0'></td> <td class='py-0'></td> <td class='font12 py-0'><strong>Subtotal</strong></td> <td class='font12 py-0'>$discount_price</td> </tr> <tr> <td class='py-0'></td> <td class='py-0'></td> <td class='py-0'></td> <td class='py-0'></td> <td class='py-0'></td> <td class='py-0'></td> <td class='py-0'></td> <td class='font12 py-0'><strong>Amount Paid</strong></td> <td class='font12 py-0'>$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:13px;'>Total Amount Chargeable in USD - ".numberTowords("$amount_paid")."</p> </div> <div> <div class='row pt-4'> <div class='col-md-6 float-left'> <p class='mb-0 '><strong> Beneficary Name : $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 : $address</p> <div class='pt-3'> <p><strong>Declaration</strong>: We hereby declare that this invoice shows the actual price of the goods described and that allparticular are trye and correct. </p> </div> </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='images/stamp.png' width='100'></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->WriteHTML($html); // error_reporting(E_ALL); // ob_end_clean(); // $mpdf->Output("qw.pdf","D"); $mpdf->Output(); exit; ?>