Ejemplo n.º 1
0
 public function Contents($row)
 {
     date_default_timezone_set('Asia/Colombo');
     //set the time zone to Colombo time
     $dt = new DateTime();
     //create DateTime object
     $this->SetY(18);
     $this->SetFont("Times", "", 10);
     $this->Ln(6);
     $this->Cell(28, 4, "Month of supply :", 0);
     $this->Cell(28, 4, $dt->format('M'), 0);
     //parameter
     $this->Cell(12, 4, "Date :", 0);
     $this->Cell(25, 4, $dt->format('y-m-d'), 0);
     //parameter
     $this->Ln(4);
     $this->Cell(28, 4, "Sup. Code :", 0);
     $this->Cell(28, 4, $row['supp_code'], 0);
     //parameter
     $this->Cell(12, 4, "Name :", 0);
     $this->Cell(81, 4, $row['f_name'] . " " . $row['l_name'], 0);
     //parameter
     $this->Ln(6);
     $this->Cell(31, 4, "Supplied tea leaves :", 0);
     $this->Cell(20, 4, $row['total_supp_kgs'], 0);
     //parameter
     $this->Cell(27, 4, "Price of 1kg : Rs.", 0);
     $this->Cell(15, 4, 50, 0);
     //parameter IN HERE 50 IS A DUMY DATA> WE SHOULD ORGANIZE THIS
     $suppliedTotal = Calculations::calculateSuppliedTotal($row['total_supp_kgs'], 50);
     $this->Cell(30, 4, $suppliedTotal, 0, 0, "R");
     //parameter
     $this->Ln(4);
     $this->Cell(27, 4, "Direct additions :", 0);
     $this->Cell(96, 4, $row['direct_addition'], 0, 0, "R");
     //parameter
     $this->Ln(4);
     $this->Cell(27, 4, "Other additions :", 0);
     $this->Cell(96, 4, $row['other_addition'], 0, 0, "R");
     //parameter
     $this->Ln(5);
     $mothlyTotalIncome = Calculations::total($suppliedTotal, $row['direct_addition'], $row['other_addition']);
     $this->Cell(27, 4, "Total :", 0);
     $this->Cell(96, 4, number_format($mothlyTotalIncome, 2), 0, 0, "R");
     //parameter
     $this->Ln(6);
     $this->SetFont("Times", "B", 12);
     $this->Cell(48, 4, "Abscissions", 0);
     $this->Ln(6);
     $this->SetFont("Times", "", 10);
     $this->Cell(48, 4, "Last month arrears :", 0);
     $this->Cell(30, 4, $row['last_month_debt'], 0, 0, "R");
     //parameter
     $this->Ln(4);
     $this->Cell(48, 4, "Loan :", 0);
     $this->Cell(30, 4, $row['debt'], 0, 0, "R");
     //parameter
     $this->Ln(4);
     $this->Cell(48, 4, "Advancement :", 0);
     $this->Cell(30, 4, $row['advance'], 0, 0, "R");
     //parameter
     $this->Ln(4);
     $this->Cell(48, 4, "This month manure installment :", 0);
     $this->Cell(30, 4, $row['manure'], 0, 0, "R");
     //parameter
     $this->Ln(4);
     $this->Cell(48, 4, "Tea :", 0);
     $this->Cell(30, 4, $row['tea'], 0, 0, "R");
     //parameter
     $this->Ln(4);
     $this->Cell(48, 4, "Stationaries :", 0);
     $this->Cell(30, 4, $row['stationary'], 0, 0, "R");
     //parameter
     $this->Ln(4);
     $this->Cell(48, 4, "Transport charge :", 0);
     $this->Cell(30, 4, $row['transport'], 0, 0, "R");
     //parameter
     $this->Ln(4);
     $this->Cell(48, 4, "Other/scripts :", 0);
     $this->Cell(30, 4, $row['other_bscissions'], 0, 0, "R");
     //parameter
     $this->Ln(4);
     $this->Cell(48, 4, "Stamp :", 0);
     $this->Cell(30, 4, $row['stamp'], 0, 0, "R");
     //parameter
     $this->Ln(5);
     $this->Cell(48, 4, "Total abscissions :", 0);
     $totalAbscissions = Calculations::totalAbscissions($row['last_month_debt'], $row['debt'], $row['advance'], $row['manure'], $row['tea'], $row['stationary'], $row['transport'], $row['other_bscissions'], $row['stamp']);
     $this->Cell(75, 4, number_format($totalAbscissions, 2), 0, 0, "R");
     //parameter
     $this->Ln(5);
     $this->SetFont("Times", "B", 12);
     $this->Cell(48, 4, "Balance :", 0);
     $balance = Calculations::balance($mothlyTotalIncome, $totalAbscissions);
     $this->Cell(75, 4, "Rs. " . number_format($balance, 2), 0, 0, "R");
     //parameter
     $this->Ln(10);
     $this->SetFont("Times", "B", 10);
     $this->Cell(20, 4, "Land Details", 0, 1);
     $this->SetFont("Times", "", 10);
     $this->Cell(20, 4, "Land name :", 0);
     $this->Cell(75, 4, $row['estate_name'], 0, 0, "L");
     //parameter
     $this->Ln(4);
     $this->Cell(20, 4, "Land area :", 0);
     $this->Cell(75, 4, $row['size_of_estate'], 0, 0, "L");
     //parameter
     $this->Ln(4);
     $this->Cell(20, 4, "Reg. No. :", 0);
     $this->Cell(75, 4, $row['reg_no'], 0, 0, "L");
     //parameter
     $this->Ln(1);
 }
Ejemplo n.º 2
0
 /**
  * Create widget on object creation 
  **/
 public function __construct($context)
 {
     parent::__construct($context);
     //**********************************START OF VAR INIT**********************************************
     $validator = new Validation();
     $calculations = new Calculations();
     //current, increase and new order values
     $CorderVal = $validator->calcInputCheck('CorderVal');
     $IorderVal = $validator->calcInputCheck('IorderVal');
     $NorderVal = $calculations->increasebyPercentage($CorderVal, $IorderVal);
     //current, increase and new visitors per month
     $CvisitorsPerMonth = $validator->calcInputCheck('CvisitorsPerMonth');
     $IvisitorsPerMonth = $validator->calcInputCheck('IvisitorsPerMonth');
     $NvisitorsPerMonth = $calculations->increasebyPercentage($CvisitorsPerMonth, $IvisitorsPerMonth);
     //current, increase and new conversion rate
     $CconversionRate = $validator->calcInputCheck('CconversionRate');
     $IconversionRate = $validator->calcInputCheck('IconversionRate');
     $NconversionRate = $calculations->increasebyPercentage($CconversionRate, $IconversionRate);
     //current, Increase and new Av Margins
     $CavMargin = $validator->calcInputCheck('CavMargin');
     $IavMargin = $validator->calcInputCheck('IavMargin');
     $NavMargin = $calculations->increaseByPercentage($CavMargin, $IavMargin);
     //current, increase and new revenue values
     $Crevenue = $calculations->computeRevenue($CorderVal, $CvisitorsPerMonth, $CconversionRate);
     $Nrevenue = $calculations->computeRevenue($NorderVal, $NvisitorsPerMonth, $NconversionRate);
     $Irevenue = $calculations->computePercentageIncrease($Crevenue, $Nrevenue);
     //current, increase and new Gross Profit Margin
     $Cgpm = $calculations->computeGrossProfitMargin($Crevenue, $CavMargin);
     $Ngpm = $calculations->computeGrossProfitMargin($Nrevenue, $NavMargin);
     $Igpm = $calculations->computePercentageIncrease($Cgpm, $Ngpm);
     //Investement capital and ROI
     $investement = $validator->calcInputCheck('investement');
     $roi = $calculations->computeROI($investement, $Ngpm, $Cgpm);
     //*********************************ENDOF VAR INIT**************************************************
     //*********************************START OF HTML***************************************************
     //initialise rows for calculator table
     $row1 = $this->headerRow("Current Value", "Percentage Increase", "New Value");
     $row2 = $this->calculationRow("Av Order Value", $CorderVal, $IorderVal, "CorderVal", "IorderVal", $NorderVal);
     $row3 = $this->calculationRow("Visitors Per Month", $CvisitorsPerMonth, $IvisitorsPerMonth, "CvisitorsPerMonth", "IvisitorsPerMonth", $NvisitorsPerMonth);
     $row4 = $this->calculationRow("Conversion Rate", $CconversionRate, $IconversionRate, "CconversionRate", "IconversionRate", $NconversionRate);
     $row5 = $this->calculationRow("Av Margin", $CavMargin, $IavMargin, "CavMargin", "IavMargin", $NavMargin);
     $row6 = $this->resultsRow("Revenue", $Crevenue, $Irevenue, $Nrevenue);
     $row7 = $this->resultsRow("Gross Profit Margin", $Cgpm, $Igpm, $Ngpm);
     $row8 = $this->investROIrow("Investement", "ROI", $investement, "investement", $roi);
     //create table from above rows,
     $calcTable = HTML_Gen::element("TABLE", "class='table table-bordered'", $row1 . $row2 . $row3 . $row4 . $row5 . $row6 . $row7 . $row8);
     $submitBtn = HTML_Gen::element("INPUT", "type='submit' value='submit'", "");
     $calcForm = HTML_Gen::element("FORM", "action='{$context}' method='POST'", $calcTable . $submitBtn);
     echo $calcContainer = HTML_Gen::element("DIV", "class='form-group'", $calcForm);
     //*******************************ENDOF HTML*******************************************************
 }