D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
shubmkcj
/
urbane.createerp.com
/
Filename :
view-manufacturer-payment-details.php
back
Copy
<?php error_reporting(0); require_once ('vendor/autoload.php'); use \Statickidz\GoogleTranslate; $trans = new GoogleTranslate(); $source = 'en'; $target = 'zh'; require ('config.php'); $id = $_GET['id']; $query_c="SELECT * FROM `conversion_rate` ORDER BY `conversion_rate`.`id` DESC LIMIT 1"; $result_c = mysqli_query($conn, $query_c); $row_c = mysqli_fetch_assoc($result_c); $last_rmb = $row_c["rmb"]; // 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']; $contactsql = mysqli_query($conn,"SELECT * FROM `manufacturer` where id='$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']; $manu_pin = $contactrow['pin']; if(!empty($manu_email)){ $manu_email="Contact Email: ".$manu_email; } if(!empty($manu_phone)){ $manu_phone="Contact No.: ".$manu_phone; } $currency = $contactrow['currency']; $address_get = $contactrow['address'] .', '. $contactrow['city'] .', '. $contactrow['state'] .', '. $contactrow['country']; $iidks_items=''; $space = ''; $totatdebetAmt = 0.00; $creditAmt = 0.00; $remainAmt = 0.00; $amount_paid = 0.00; $sqlAssign1 = "SELECT * FROM `purchase_order` where `manufacturer`='$id' AND data_delete = 'NO' order by `purchase_order`.`id` desc"; $resultAssign1 = mysqli_query( $conn, $sqlAssign1 ); if ( mysqli_num_rows( $resultAssign1 ) > 0 ) { while( $rows = mysqli_fetch_assoc( $resultAssign1 ) ) { $gen_inv_id = $rows['id']; $aa = $rows['order_date']; $po_id = $rows['po_id']; $cc = $rows['proforma_id']; $ee = $rows['amount_paind']; $amt_in_usd = $rows['amt_in_usd']; if($currency=='RMB'){ $last_rmb=$last_rmb; }else{ $last_rmb=1; } if($amt_in_usd==''){ $amount_paid=$ee/$last_rmb; }else{ $amount_paid=$amt_in_usd; } $bill_pay_name = $rows['manufacturer']; $totatAmt = sprintf( '%0.2f', ( $amount_paid ) ); $totatdebetAmt = sprintf( '%0.2f', ( $totatdebetAmt+$amount_paid ) ); $inv_date_date = date_create( $aa ); $inv_date_date = date_format( $inv_date_date, "d-m-Y" ); $iidks_items .= '<tr style="width:100%"> <td class="font12" style="padding:10px;width:20%"> '.$inv_date_date.' </td> <td class="font12" style="padding:10px;width:20%">'.$po_id.'</td> <td class="font12" style="padding:10px;width:20%"> </td> <td class="font12" style="padding:10px;width:20%;text-align:right"> <strong style="font-weight:bold;color:#000">'.$totatAmt.'</strong></td> <td class="font12" style="padding:10px;width:20%"> </td> </tr>'; // echo "<br>"; $sqlGetPaidAmount = "SELECT * FROM `purchase_order_payments` WHERE `manufacturer_id` = '$id' AND `po_no` = '$po_id' AND transaction_type = 'Credit' AND is_deleted = 'no'"; $resultGetPaidAmount = mysqli_query( $conn, $sqlGetPaidAmount ); if ( $resultGetPaidAmount ) { if ( mysqli_num_rows( $resultGetPaidAmount ) > 0 ) { while( $rowGetPaidAmount = mysqli_fetch_assoc( $resultGetPaidAmount ) ) { $payment_id = $rowGetPaidAmount["po_no"] ; $amountq = $rowGetPaidAmount["amount"] ; $payment_in_usd = $rowGetPaidAmount["amount_in_usd"]; if($currency=='RMB'){ $last_rmb=$last_rmb; }else{ $last_rmb=1;; } if($payment_in_usd==''){ $amountq = $amountq/$last_rmb; }else{ $amountq=$payment_in_usd; } $pmode = $rowGetPaidAmount["payment_mode"] ; $payment_date = $rowGetPaidAmount["payment_date"] ; // $transaction_reference_no = $rowGetPaidAmount["details_profroma_no"] ; // if ( !empty( $transaction_reference_no ) ) { // $transaction_reference_no = 'Profroma No. '.$transaction_reference_no; // } else { // $transaction_reference_no = ''; // } $creditAmt1 = sprintf( '%0.2f', ( $amountq ) ); $creditAmt = sprintf( '%0.2f', ( $creditAmt+$amountq ) ); $pay_date_date = date_create( $payment_date ); $pay_date_date = date_format( $pay_date_date, "d-m-Y" ); $iidks_items .= '<tr style="width:100%"> <td class="font12" style="padding:10px;width:20%"> '.$pay_date_date.' </td> <td class="font12" style="padding:10px;width:20%">'.$payment_id.'</td> <td class="font12" style="padding:10px;width:20%"> '.$pmode.' </td> <td class="font12" style="padding:10px;width:20%"> </td> <td class="font12" style="padding:10px;width:20%;font-weight:600;text-align:right"> <strong style="font-weight:bold;color:#000">'.$creditAmt1.'</td> </tr>'; } } } } } $remainAmt = sprintf( '%0.2f', ( $totatdebetAmt-$creditAmt ) ); // echo "<br>"; // die; $us_amt_row="<tr> <td class='py-0' style='padding:8px;'></td> <td class='py-0' style='padding:8px;'></td> <td class='py-0' style='padding:8px;'></td> <td class='font12 py-0' style='padding:8px;'><strong>Balance Amount </strong><small>(USD)</small></td> <td class='font12 py-0' style='padding:8px;'><strong style='font-weight:bold;color:#000;font-size:18px'>$remainAmt</strong></td> </tr> <div class='col-md-12 p-0'> <p style='display:block;background:#afafaf;text-align:center;color:#fff;font-size:13px;'>Balance Amount in USD - ".numberTowords("$remainAmt")."</p> </div> "; $amt_in_figure=" </tr> <div class='col-md-12 p-0'> <p style='display:block;background:#afafaf;text-align:center;color:#fff;font-size:13px;'>Balance Amount in USD - ".numberTowords("$remainAmt")."</p> </div> "; // 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 pt-1'> <div class='col-md-12 text-center'> <h3 class='mb-0' ><strong style='color:#000'>".ucfirst($manufacturer_display_name)."</strong></h3> <p class='mb-0 font12'>$address_get</p> <p class='mb-0 font12'>Zip Code : $manu_pin</p> <p class='mb-0 font12' >Contact Person: $contact_person_name</p> <p class='mb-0 font12'>$manu_phone</p> <p class='mb-0 font12'>$manu_email</p> </div> </div> <div class='row pt-3'> <table class='table table-striped'> <thead> <tr style='width:100%'> <th class='bac_color font14' style='border-top:1px solid #afafaf;border-bottom:1px solid #afafaf;background: #fff !important; color:#444; padding:8px;'>Date</th> <th class='bac_color font14' style='border-top:1px solid #afafaf;border-bottom:1px solid #afafaf;background: #fff !important; color:#444; padding:8px;'>PO Id</th> <th class='bac_color font14' style='border-top:1px solid #afafaf;border-bottom:1px solid #afafaf;background: #fff !important; color:#444; padding:8px;'>Payment Mode</th> <th class='bac_color font14' style='border-top:1px solid #afafaf;border-bottom:1px solid #afafaf;background: #fff !important; color:#444; padding:8px;text-align:center'> Amount <small>(in USD)<small></th> <th class='bac_color font14' style='border-top:1px solid #afafaf;border-bottom:1px solid #afafaf;background: #fff !important; color:#444; padding:8px;text-align:right'>Paid <small>(in USD)<small></th> </tr> </thead> <tbody> $iidks_items <tr> <td class='py-0' style='border-top:1px solid #afafaf;border-bottom:1px solid #afafaf;background: #fff !important; color:#444; padding:8px;'></td> <td class='py-0' style='border-top:1px solid #afafaf;border-bottom:1px solid #afafaf;background: #fff !important; color:#444; padding:8px;'></td> <td class='py-0' style='border-top:1px solid #afafaf;border-bottom:1px solid #afafaf;background: #fff !important; color:#444; padding:8px;'><strong >Sub Total</strong></td> <td class='font12 py-0' style='border-top:1px solid #afafaf;border-bottom:1px solid #afafaf;background: #fff !important; color:#444; padding:8px;text-align:right'><strong style='font-weight:bold;color:#000;font-size:16px'>$totatdebetAmt</strong></td> <td class='font12 py-0' style='border-top:1px solid #afafaf;border-bottom:1px solid #afafaf;background: #fff !important; color:#444; padding:8px;text-align:right'><strong style='font-weight:bold;color:#000;font-size:16px'>$creditAmt</strong></td> </tr> $us_amt_row </tbody> </table> $amt_in_figure <div> <hr> <div class='row pt-1'> <div class='col-md-6 float-left'> </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; ?>