where('settings','buttontext')->get(); $buttonData=$data[0]->value; include_once("generateQRcode/phpqrcode/qrlib.php"); if(isset($_POST["submit"])) { $id=$_GET['id']; function get_client_id() { $id=$_GET['id']; return $id; } include_once("generateQRcode/TCPDF-main/tcpdf.php"); class myPDF extends TCPDF { public $globalcheckdue = 0; public $qrheigh = 0; public function Header() { // $this->setRTL(true); $this->SetPrintHeader(false); } public function Footer() { $this->SetPrintFooter(false); } function table_client() { $CompanyName = Capsule::table('tblconfiguration')->where('setting','CompanyName')->get(); $system_CompanyName = $CompanyName[0]->value; $this->SetFont('aealarabiya','B',13); $this->SetXY(155,2); $this->Write(-5,$system_CompanyName); $LogoURL = Capsule::table('tblconfiguration')->where('setting','LogoURL')->get(); foreach ($LogoURL as $value){ $finalLogoURL = $value->value; } $LogoURLPath = parse_url($finalLogoURL, PHP_URL_PATH); $AbsoluteFilePath = $LogoURLPath; $pathinfo = pathinfo($AbsoluteFilePath); $fileextension = $pathinfo['extension']; if($fileextension !== "svg") { $this->Image($AbsoluteFilePath,10,-4,20,20); }else{ $this->ImageSVG($AbsoluteFilePath,10,-4,20,20); } $headertext = Capsule::table('tblIqr_setting')->where('settings','headertext')->get(); $headertextvalue=$headertext[0]->value; if(!empty($headertextvalue)) { $this->SetTextColor(255,0,0); $this->SetXY(10,12); $this->MultiCell(0, 0, $headertextvalue, 0, 'C', false, 1); } $id=get_client_id(); $get= Capsule::table("tblinvoices")->where("id",$id)->get(); $user_id= $get[0]->userid; $clientdetails= Capsule::table("tblclients")->where("id",$user_id)->get(); $this->SetTextColor(0,0,0); $this->setFillColor(230,230,230); $this->SetY(25); $client='العميل'; $details='بيانات'; $this->Cell(190,12,"Client Details / $client $details",1,1,'C',true); $this->Cell(95,8,'Name / الاسم',1,0,'L',0); $this->Cell(95,8,$clientdetails[0]->firstname." ".$clientdetails[0]->lastname,1,1,'L',0); $this->Cell(95,8,'Company Name / الشركة',1,0,'L',0); $this->Cell(95,8,$clientdetails[0]->companyname,1,1,'L',0); $email='الالكتروني'; $email1='البريد'; $this->Cell(95,8,"Email /$email $email1 ",1,0,'L',0); $this->Cell(95,8,$clientdetails[0]->email,1,1,'L',0); $this->Cell(95,8,'Address / العنوان',1,0,'L',0); $this->Cell(95,8,$clientdetails[0]->address1,1,1,'L',0); $countryu='والمدينة'; $country1='الدولة'; $this->Cell(95,8,"City / State / Country / Pincode /$countryu $country1 ",1,0,'L',0); $this->Cell(95,8,$clientdetails[0]->city.' / '.$clientdetails[0]->state.' / '.$clientdetails[0]->country.' / '.$clientdetails[0]->postcode,1,1,'L',0); $phoneno='الهاتف'; $phoneno1='رقم'; $this->Cell(95,8,"Phone Number / $phoneno $phoneno1 ",1,0,'L',0); $this->Cell(95,8,$clientdetails[0]->phonenumber,1,1,'L',0); $this->Ln(); return $this; } function table_invoice() { $id=get_client_id(); $get= Capsule::table("tblinvoices")->where("id",$id)->get(); $tax_rate1=$get[0]->taxrate; $tax_rate2=$get[0]->taxrate2; $user_id= $get[0]->userid; $command = 'GetInvoices'; $postData = array( 'userid' => $user_id, ); $results = localAPI($command, $postData); $currency_code=$results['invoices']['invoice'][0]['currencycode']; $clientdetails= Capsule::table("tblclients")->where("id",$user_id)->get(); $country=$clientdetails[0]->country; $state=$clientdetails[0]->state; if($tax_rate1>0) { $get= Capsule::table("tblinvoices")->where("id",$id)->get(); $tax_price1=$get[0]->tax; $tax_details1= Capsule::table("tbltax")->where("level",1)->where("state",$state)->where("Country",$country)->where("taxrate",$tax_rate1)->count(); if($tax_details1>0) { $tax_details1= Capsule::table("tbltax")->where("level",1)->where("state",$state)->where("Country",$country)->where("taxrate",$tax_rate1)->get(); $tax_name1=$tax_details1[0]->name; }else { $tax_details1= Capsule::table("tbltax")->where("level",1)->where("Country",$country)->where("taxrate",$tax_rate1)->count(); if($tax_details1>0) { $tax_details1= Capsule::table("tbltax")->where("level",1)->where("Country",$country)->where("taxrate",$tax_rate1)->get(); $tax_name1=$tax_details1[0]->name; }else { $tax_details1= Capsule::table("tbltax")->where("level",1)->where("Country"," ")->where("taxrate",$tax_rate1)->count(); if($tax_details1>0) { $tax_details1= Capsule::table("tbltax")->where("level",1)->where("Country"," ")->where("taxrate",$tax_rate1)->get(); $tax_name1=$tax_details1[0]->name; } } } } $getdescription= Capsule::table("tblinvoiceitems")->where("invoiceid",$id)->get(); $Invoice ='تفاصيل'; $details =' الفاتورة'; $this->SetLeftMargin(10); $this->SetY(87); $width_fourth_cell = array(190); $this->Cell($width_fourth_cell[0],12,"Invoice Details /$details $Invoice",1,1,C,true); $invoice1='الفاتورة'; $urdu_id='رقم'; $this->Cell(95,8,"Invoiceid / $invoice1 $urdu_id ",1,0,'L',0); $this->Cell(95,8,$get[0]->id,1,1,'L',0); $date='الفاتورة'; $date1='تاريخ'; $this->Cell(95,8,"Date /$date $date1 ",1,0,'L',0); $this->Cell(95,8,$get[0]->date,1,1,'L',0); $due='الاستحقاق'; $date='تاريخ'; $this->Cell(95,8,"DueDate /$due $date ",1,0,'L',0); $this->Cell(95,8,$get[0]->duedate,1,1,'L',0); return $this; } function description() { $id=get_client_id(); $get= Capsule::table("tblinvoices")->where("id",$id)->get(); $user_id= $get[0]->userid; $command = 'GetInvoices'; $postData = array( 'userid' => $user_id, ); $results = localAPI($command, $postData); $currency_code=$results['invoices']['invoice'][0]['currencycode']; $status = $get[0]->status; $getdescription= Capsule::table("tblinvoiceitems")->where("invoiceid",$id)->get(); $this->SetLeftMargin(10); $table_topmargin=125; $this->SetY( $table_topmargin); $this->setFillColor(230,230,230); $items='أغراض'; $invoice='الفاتورة'; $this->Cell(146,12,"Invoice Items /$invoice $items ",1,0,'C',true); $this->Cell(44,12,'Amount / مقدار',1,1,'L',true); $values = ""; foreach ($getdescription as $value) { $values.= '