Example #1
0
     }
     $years[] = array("year_id" => $row['year_id'] * 1, "period" => $period);
 }
 $result->close();
 //dump($years);
 while (count($years) < 3) {
     $years[] = array("year_id" => 0, "period" => "");
 }
 $years = array_reverse($years);
 $rows = array();
 foreach ($years as $year) {
     $forPl = "No";
     if ($activeYear == $year['year_id']) {
         $forPl = "Yes";
     }
     $rows[] = getProfitLostForYear($year['year_id'], $forPl);
 }
 if ($_GET['report'] == 'pdf') {
     require_once '../includes/PDFReport.class.php';
     class PDF extends PDFReport
     {
         function Header()
         {
             $this->SetFont('Arial', 'B', 18);
             // $this->Cell(0, 6, $_SESSION['companyname'], 0, 0, 'C');
             $this->SetFont('Arial', '', 12);
             $this->SetX(-35);
             $this->Cell(0, 6, date("M d, Y"), 0, 0, 'R');
             $this->Ln(0);
             $this->printTitle();
             //Ensure table header is output
Example #2
0
       " WHERE vd.account_ref_id = (\n" .
       "    SELECT s.code FROM sys_codes s\n" .
       "     WHERE s.parent_ref_id = (SELECT ss.sys_codes_ref_id FROM sys_codes ss WHERE ss.code = 'IMP_COA' AND ss.company_ref_id = s.company_ref_id)\n" .
       "       AND s.company_ref_id = 1 AND s.description = 'Profit & Loss Account')\n" .
       "   AND vm.year_id = $_GET[fyear]\n";
   $result = $mysqli->query($sql);
   if ($row = $result->fetch_assoc()) {
       $balance["Profit & Loss"] = (float)$row['drcr'];
   }*/
 $forPl = getIVal("is_close", "sys_financial_year", "year_id = {$_GET['fyear']}");
 if ($forPl == 'Yes') {
     $forPl = 'No';
 } else {
     $forPl = 'Yes';
 }
 $profitLoss = getProfitLostForYear($_GET['fyear'], $forPl);
 $netSales = $profitLoss['Cash Sales'] + $profitLoss['Credit Sales'] - ($profitLoss['Sales Return'] + $profitLoss['Sales Discount']);
 $netPurchase = $profitLoss['Cash Purchase'] + $profitLoss['Credit Purchase'] - ($profitLoss['Purchase Return'] + $profitLoss['Purchase Discount']);
 $cogs = $profitLoss['Open Inventory'] + $netPurchase - $profitLoss['Close Inventory'];
 $grossProfit = $netSales - $cogs;
 $netProfitLoss = $grossProfit - $profitLoss['Total Expenses'];
 foreach ($profitLoss['Other Income'] as $otherIncome) {
     $netProfitLoss += $otherIncome['amt'];
 }
 $balance["Profit & Loss"] = $netProfitLoss;
 //$printReport = false;
 $printReport = true;
 if ($printReport === true) {
     require_once '../../Classes/PHPExcel.php';
     $padding = 0.71;
     $objPHPExcel = new PHPExcel();
Example #3
0
 $sql = "SELECT y.year_id FROM sys_financial_year y WHERE y.is_active = 'Yes' AND y.company_ref_id = {$_GET['company']}";
 $result = mysql_query($sql);
 $row = mysql_fetch_assoc($result);
 $data['year_id'] = $row['year_id'];
 dump($data);
 $prereq = true;
 $prereq &= $data['balance'] == 0;
 $prereq &= strlen($data['re_code']) > 0;
 $prereq &= strlen($data['sl_code']) > 0;
 $prereq &= strlen($data['sh_code']) > 0;
 $prereq &= strlen($data['cg_code']) > 0;
 $prereq &= strlen($data['year_id']) > 0;
 $prereq &= $data['sd'] == 1;
 //$prereq &= ($data['ed'] == 0);
 if ($prereq) {
     $profitLoss = getProfitLostForYear($data['year']);
     $profitLoss['Net Sales'] = $profitLoss['Cash Sales'] + $profitLoss['Credit Sales'] - $profitLoss['Sales Return'] - $profitLoss['Sales Discount'];
     $profitLoss['Net Purchase'] = $profitLoss['Cash Purchase'] + $profitLoss['Credit Purchase'] - $profitLoss['Purchase Return'] - $profitLoss['Purchase Discount'];
     dump($profitLoss);
     $code = getAccountRefIdByCode('Sales Return', $_GET['company']);
     if (strlen($code) > 0) {
         /*$createVoucher = createVoucher($_GET['company'], $data['year'], $data['sh_code'], $code, $profitLoss['Sales Return'], 'Account Closing Sales Return', null, 'CO', date("Y-m-d"), $_SESSION['user_id']);
           dump($createVoucher);*/
         $createVoucher = createVoucher($_GET['company'], $data['year'], $data['sl_code'], $code, $profitLoss['Sales Return'], 'Account Closing Sales Return', null, 'CO', date("Y-m-d"), $_SESSION['user_id']);
         dump($createVoucher);
     }
     $code = getAccountRefIdByCode('Sales Discount', $_GET['company']);
     if (strlen($code) > 0) {
         $createVoucher = createVoucher($_GET['company'], $data['year'], $data['sl_code'], $code, $profitLoss['Sales Discount'], 'Account Closing Sales Discount', null, 'CO', date("Y-m-d"), $_SESSION['user_id']);
         dump($createVoucher);
     }
Example #4
0
 $sql = "SELECT y.year_id FROM sys_financial_year y WHERE y.is_active = 'Yes' AND y.company_ref_id = {$_GET['company']}";
 $result = mysql_query($sql);
 $row = mysql_fetch_assoc($result);
 $data['year_id'] = $row['year_id'];
 dump($data);
 $prereq = true;
 $prereq &= $data['balance'] == 0;
 $prereq &= strlen($data['re_code']) > 0;
 $prereq &= strlen($data['sl_code']) > 0;
 $prereq &= strlen($data['sh_code']) > 0;
 $prereq &= strlen($data['cg_code']) > 0;
 $prereq &= strlen($data['year_id']) > 0;
 $prereq &= $data['sd'] == 1;
 //$prereq &= ($data['ed'] == 0);
 if ($prereq) {
     $profitLoss = getProfitLostForYear($_GET['year']);
     $profitLoss['Net Sales'] = $profitLoss['Cash Sales'] + $profitLoss['Credit Sales'] - $profitLoss['Sales Return'] - $profitLoss['Sales Discount'];
     $profitLoss['Net Purchase'] = $profitLoss['Cash Purchase'] + $profitLoss['Credit Purchase'] - $profitLoss['Purchase Return'] - $profitLoss['Purchase Discount'];
     dump($profitLoss);
     $code = getAccountRefIdByCode('Sales Return', $_GET['company']);
     if (strlen($code) > 0) {
         /*$createVoucher = createVoucher($_GET['company'], $_GET['year'], $data['sh_code'], $code, $profitLoss['Sales Return'], 'Account Closing Sales Return', null, 'CO', date("Y-m-d"), $_SESSION['user_id']);
           dump($createVoucher);*/
         $createVoucher = createVoucher($_GET['company'], $_GET['year'], $data['sl_code'], $code, $profitLoss['Sales Return'], 'Account Closing Sales Return', null, 'CO', date("Y-m-d"), $_SESSION['user_id']);
         dump($createVoucher);
     }
     $code = getAccountRefIdByCode('Sales Discount', $_GET['company']);
     if (strlen($code) > 0) {
         $createVoucher = createVoucher($_GET['company'], $_GET['year'], $data['sl_code'], $code, $profitLoss['Sales Discount'], 'Account Closing Sales Discount', null, 'CO', date("Y-m-d"), $_SESSION['user_id']);
         dump($createVoucher);
     }