コード例 #1
0
ファイル: trademargin.php プロジェクト: Niqpue/zippyerp
 public function generateReport()
 {
     $header = array('date' => date('d.m.Y', $this->document_date), "document_number" => $this->document_number, "storename" => $this->headerdata['storename']);
     $report = new \ZippyERP\ERP\Report('trademargin.tpl');
     $html = $report->generate($header);
     return $html;
 }
コード例 #2
0
ファイル: finresult.php プロジェクト: Niqpue/zippyerp
 public function generateReport()
 {
     $header = array('date' => date('d.m.Y', $this->document_date), "document_number" => $this->document_number);
     $report = new \ZippyERP\ERP\Report('finresult.tpl');
     $html = $report->generate($header);
     return $html;
 }
コード例 #3
0
ファイル: obsaldo.php プロジェクト: Niqpue/zippyerp
 private function generateReport()
 {
     $acclist = Account::find("", "cast(acc_code as char)");
     $detail = array();
     $totstartdt = 0;
     $totstartct = 0;
     $totobdt = 0;
     $totobct = 0;
     $totenddt = 0;
     $totendct = 0;
     $from = $this->filter->from->getDate();
     $to = $this->filter->to->getDate();
     foreach ($acclist as $acc) {
         $data = $acc->getSaldoAndOb($from, $to);
         //получаем остатки  и  обороты  на  период
         $detail[] = array("acc_code" => $acc->acc_code, 'startdt' => H::fm($data['startdt']), 'startct' => H::fm($data['startct']), 'obdt' => H::fm($data['obdt']), 'obct' => H::fm($data['obct']), 'enddt' => H::fm($data['enddt']), 'endct' => H::fm($data['endct']));
         if ($acc->acc_pid == 0) {
             $totstartdt += $data['startdt'];
             $totstartct += $data['startct'];
             $totobdt += $data['obdt'];
             $totobct += $data['obct'];
             $totenddt += $data['enddt'];
             $totendct += $data['endct'];
         }
     }
     $header = array('from' => date('d.m.Y', $from), 'to' => date('d.m.Y', $to), 'totstartdt' => H::fm($totstartdt), 'totstartct' => H::fm($totstartct), 'totobdt' => H::fm($totobdt), 'totobct' => H::fm($totobct), 'totenddt' => H::fm($totenddt), 'totendct' => H::fm($totendct));
     $report = new \ZippyERP\ERP\Report('obsaldo.tpl');
     $html = $report->generate($header, $detail);
     return $html;
 }
コード例 #4
0
ファイル: contract.php プロジェクト: Niqpue/zippyerp
 public function generateReport()
 {
     $customer = \ZippyERP\ERP\Entity\Customer::load($this->headerdata["customer"]);
     $header = array('date' => date('d.m.Y', $this->document_date), "document_number" => $this->document_number, "customer" => $customer->customer_name, "description" => $this->headerdata["description"], 'startdate' => date('d.m.Y', $this->headerdata["startdate"]), 'enddate' => date('d.m.Y', $this->headerdata["enddate"]), "amount" => H::fm($this->headerdata["amount"]));
     $report = new \ZippyERP\ERP\Report('contract.tpl');
     $html = $report->generate($header);
     return $html;
 }
コード例 #5
0
ファイル: transferorder.php プロジェクト: Niqpue/zippyerp
 public function generateReport()
 {
     $myfirm = \ZippyERP\System\System::getOptions("firmdetail");
     $myaccount = \ZippyERP\ERP\Entity\MoneyFund::load($this->headerdata['bankaccount']);
     $mybank = \ZippyERP\ERP\Entity\Bank::load($myaccount->bank);
     $customer = \ZippyERP\ERP\Entity\Customer::load($this->headerdata['customer']);
     $cbank = \ZippyERP\ERP\Entity\Bank::load($customer->bank);
     $header = array('date' => date('d.m.Y', $this->document_date), 'myname' => $myfirm['name'], 'mycode' => $myfirm['code'], 'mybankaccount' => $myaccount->bankaccount, 'mybank' => $mybank->bank_name, 'mybankcode' => $mybank->mfo, 'cname' => $customer->customer_name, 'ccode' => $customer->code, 'cbankaccount' => $customer->bankaccount, 'cbank' => $cbank->bank_name, 'cbankcode' => $cbank->mfo, "document_number" => $this->document_number, "document_date" => date('Y.m.d', $this->document_date), "notes" => $this->headerdata['notes'], "amount" => H::fm($this->amount), "amountstr" => \ZippyERP\ERP\Util::ucfirst(\ZippyERP\ERP\Util::money2str($this->amount / 100)));
     $report = new \ZippyERP\ERP\Report('transferorder.tpl');
     $html = $report->generate($header, array());
     return $html;
 }
コード例 #6
0
ファイル: revaluationret.php プロジェクト: Niqpue/zippyerp
 public function generateReport()
 {
     $header = array('date' => date('d.m.Y', $this->document_date), "document_number" => $this->document_number, "summa" => H::fm($this->headerdata['summa']), "store" => $this->headerdata['storename']);
     $i = 1;
     $detail = array();
     foreach ($this->detaildata as $value) {
         $detail[] = array("no" => $i++, "item_name" => $value['itemname'], "measure" => $value['measure_name'], "price" => H::fm($value['price']), "newprice" => H::fm($value['newprice']));
     }
     $report = new \ZippyERP\ERP\Report('revaluationret.tpl');
     $html = $report->generate($header, $detail);
     return $html;
 }
コード例 #7
0
ファイル: registerreceipt.php プロジェクト: Niqpue/zippyerp
 public function generateReport()
 {
     $i = 1;
     $detail = array();
     foreach ($this->detaildata as $value) {
         $detail[] = array("no" => $i++, "tovar_name" => $value['itemname'], "measure" => $value['measure_name'], "quantity" => $value['quantity'] / 1000, "price" => H::fm($value['price']), "amount" => H::fm($value['quantity'] / 1000 * $value['price']));
     }
     $firm = \ZippyERP\System\System::getOptions("firmdetail");
     $header = array('date' => date('d.m.Y', $this->document_date), "firmname" => $firm['name'], "firmcode" => $firm['code'], "kassa" => $this->headerdata["kassa"], "return" => $this->headerdata["return"], "document_number" => $this->document_number, "total" => H::fm($this->headerdata["total"]), "totalnds" => H::fm($this->headerdata["totalnds"]));
     $report = new \ZippyERP\ERP\Report('registerreceipt.tpl');
     $html = $report->generate($header, $detail);
     return $html;
 }
コード例 #8
0
ファイル: goodsreceipt.php プロジェクト: Niqpue/zippyerp
 public function generateReport()
 {
     // $customer = \ZippyERP\ERP\Entity\Customer::load($this->headerdata["customer"]);
     $i = 1;
     $detail = array();
     foreach ($this->detaildata as $value) {
         $detail[] = array("no" => $i++, "itemname" => $value['itemname'], "measure" => $value['measure_name'], "quantity" => $value['quantity'] / 1000, "price" => H::fm($value['price']), "pricends" => H::fm($value['pricends']), "totalnds" => H::fm($this->headerdata["totalnds"]), "amount" => H::fm($value['amount']));
     }
     $header = array('date' => date('d.m.Y', $this->document_date), "customer" => $this->headerdata["customername"], "document_number" => $this->document_number, "totalnds" => H::fm($this->headerdata["totalnds"]), "total" => H::fm($this->headerdata["total"]));
     $report = new \ZippyERP\ERP\Report('goodsreceipt.tpl');
     $html = $report->generate($header, $detail);
     return $html;
 }
コード例 #9
0
ファイル: movebackitem.php プロジェクト: Niqpue/zippyerp
 public function generateReport()
 {
     $header = array('date' => date('d.m.Y', $this->document_date), "from" => Store::load($this->headerdata["storefrom"])->storename, "to" => Store::load($this->headerdata["storeto"])->storename, "document_number" => $this->document_number);
     $reportgen = new \ZCL\RepGen\RepGen(_ROOT . 'templates/erp/printforms/moveitem.html', $header);
     $i = 1;
     $detail = array();
     foreach ($this->detaildata as $value) {
         $detail[] = array("no" => $i++, "item_name" => $value['itemname'], "measure" => $value['measure_name'], "price" => H::fm($value['price']), "quantity" => $value['quantity'] / 1000);
     }
     $report = new \ZippyERP\ERP\Report('movebackitem.tpl');
     $html = $report->generate($header, $detail);
     return $html;
 }
コード例 #10
0
ファイル: retailissue.php プロジェクト: Niqpue/zippyerp
 public function generateReport()
 {
     $i = 1;
     $detail = array();
     foreach ($this->detaildata as $value) {
         $detail[] = array("no" => $i++, "tovar_name" => $value['itemname'], "measure" => $value['measure_name'], "quantity" => $value['quantity'] / 1000, "price" => H::fm($value['price']), "amount" => H::fm($value['quantity'] / 1000 * $value['price']));
     }
     $firm = \ZippyERP\System\System::getOptions("firmdetail");
     // $customer = \ZippyERP\ERP\Entity\Customer::load($this->headerdata["customer"]);
     $header = array('date' => date('d.m.Y', $this->document_date), "firmname" => $firm['name'], "firmcode" => $firm['code'], "customername" => $this->headerdata["customername"], "document_number" => $this->document_number, "total" => H::fm($this->headerdata["total"]), "totalnds" => H::fm($this->headerdata["totalnds"]), "summa" => Util::ucfirst(Util::money2str($total + $this->headerdata["nds"] / 100, '.', '')));
     $report = new \ZippyERP\ERP\Report('retailissue.tpl');
     $html = $report->generate($header, $detail);
     return $html;
 }
コード例 #11
0
ファイル: bankstatement.php プロジェクト: Niqpue/zippyerp
 public function generateReport()
 {
     $types = $this->getTypes();
     $i = 1;
     $detail = array();
     $total = 0;
     foreach ($this->detaildata as $value) {
         $detail[] = array("type" => $types[$value['optype']], "cust" => $value['customername'], "amount" => H::fm($value['amount']), "comment" => $value['comment']);
     }
     $header = array('date' => date('d.m.Y', $this->document_date), 'bankaccount' => \ZippyERP\ERP\Entity\MoneyFund::load($this->headerdata['bankaccount'])->title, "document_number" => $this->document_number);
     $report = new \ZippyERP\ERP\Report('bankstatement.tpl');
     $html = $report->generate($header, $detail);
     return $html;
 }
コード例 #12
0
ファイル: expensereport.php プロジェクト: Niqpue/zippyerp
 public function generateReport()
 {
     $employee = \ZippyERP\ERP\Entity\Employee::load($this->headerdata["employee"]);
     $i = 1;
     $detail = array();
     foreach ($this->detaildata as $value) {
         $detail[] = array("no" => $i++, "itemname" => $value['itemname'], "measure" => $value['measure_name'], "quantity" => $value['quantity'] / 1000, "price" => H::fm($value['price']), "pricends" => H::fm($value['pricends']), "amount" => H::fm($value['amount']));
     }
     $elist = self::expenceList();
     $header = array('date' => date('d.m.Y', $this->document_date), "employee" => $employee->shortname, "expenseamount" => H::fm($this->headerdata["expenseamount"]), "expensetype" => $elist[$this->headerdata["expensetype"]], "employee" => $employee->shortname, "document_number" => $this->document_number, "totalnds" => H::fm($this->headerdata["totalnds"]), "total" => H::fm($this->headerdata["total"]));
     $report = new \ZippyERP\ERP\Report('expensereport.tpl');
     $html = $report->generate($header, $detail);
     return $html;
 }
コード例 #13
0
ファイル: purchaseinvoice.php プロジェクト: Niqpue/zippyerp
 public function generateReport()
 {
     $i = 1;
     $detail = array();
     foreach ($this->detaildata as $value) {
         $detail[] = array("no" => $i++, "itemname" => $value['itemname'], "measure" => $value['measure_name'], "quantity" => $value['quantity'] / 1000, "price" => H::fm($value['price']), "pricends" => H::fm($value['pricends']), "amount" => H::fm($value['amount']));
     }
     $bank = \ZippyERP\ERP\Entity\Bank::load($f->bank);
     //$customer = \ZippyERP\ERP\Entity\Customer::load($this->headerdata["customer"]);
     $header = array('date' => date('d.m.Y', $this->document_date), "account" => $f->bankaccount, "bank" => $bank->bank_name, "mfo" => $bank->mfo, "address" => $firm['city'] . ', ' . $firm['street'], "customername" => $this->headerdata["customername"], "document_number" => $this->document_number, "base" => $this->base, "paydate" => date('d.m.Y', $this->headerdata["payment_date"]), "totalnds" => H::fm($this->headerdata["totalnds"]), "total" => H::fm($this->headerdata["total"]));
     $report = new \ZippyERP\ERP\Report('purchaseinvoice.tpl');
     $html = $report->generate($header, $detail);
     return $html;
 }
コード例 #14
0
ファイル: supplierorder.php プロジェクト: Niqpue/zippyerp
 public function generateReport()
 {
     $i = 1;
     $detail = array();
     $total = 0;
     foreach ($this->detaildata as $value) {
         $detail[] = array("no" => $i++, "tovar_name" => $value['itemname'], "measure" => $value['measure_name'], "quantity" => $value['quantity'] / 1000, "price" => H::fm($value['price']), "amount" => H::fm($value['quantity'] / 1000 * $value['price']));
         $total += $value['quantity'] / 1000 * $value['price'];
     }
     $header = array('date' => date('d.m.Y', $this->document_date), "customername" => $this->suppliername, "document_number" => $this->document_number, "timeline" => date('d.m.Y', $this->headerdata['timeline']), "total" => H::fm($total));
     $report = new \ZippyERP\ERP\Report('supplierorder.tpl');
     $html = $report->generate($header, $detail);
     return $html;
 }
コード例 #15
0
ファイル: warranty.php プロジェクト: Niqpue/zippyerp
 public function generateReport()
 {
     $i = 1;
     $detail = array();
     $total = 0;
     foreach ($this->detaildata as $value) {
         $detail[] = array("no" => $i++, "tovar_name" => $value['itemname'], "quantity" => $value['quantity'] / 1000, "price" => H::fm($value['price']), "amount" => H::fm($value['quantity'] / 1000 * $value['price']), "sn" => $value['sn'], "warranty" => $value['warranty']);
         $total += $value['quantity'] * $value['price'] / 100;
     }
     $firm = \ZippyERP\System\System::getOptions("firmdetail");
     $header = array('date' => date('d.m.Y', $this->document_date), "firmname" => $firm['name'], "customer" => strlen($this->headerdata["customer"]) > 0 ? $this->headerdata["customer"] : '', "document_number" => $this->document_number);
     $report = new \ZippyERP\ERP\Report('warranty.tpl');
     $html = $report->generate($header, $detail);
     return $html;
 }
コード例 #16
0
ファイル: returngoodsissue.php プロジェクト: Niqpue/zippyerp
 public function generateReport()
 {
     $i = 1;
     $detail = array();
     foreach ($this->detaildata as $value) {
         if (isset($detail[$value['item_id']])) {
             $detail[$value['item_id']]['quantity'] += $value['quantity'] / 1000;
         } else {
             $detail[$value['item_id']] = array("no" => $i++, "tovar_name" => $value['itemname'], "measure" => $value['measure_name'], "quantity" => $value['quantity'] / 1000, "price" => H::fm($value['price']), "amount" => H::fm($value['quantity'] / 1000 * $value['price']));
         }
     }
     //$customer = \ZippyERP\ERP\Entity\Customer::load($this->headerdata["customer"]);
     $header = array('date' => date('d.m.Y', $this->document_date), "customername" => $this->headerdata["customername"], "document_number" => $this->document_number, "nds" => H::fm($this->headerdata["totalnds"]), "total" => H::fm($this->headerdata["total"]), "summa" => Util::ucfirst(Util::money2str($this->headerdata["total"] / 100, '.', '')));
     $report = new \ZippyERP\ERP\Report('returngoodsissue.tpl');
     $html = $report->generate($header, $detail);
     return $html;
 }
コード例 #17
0
ファイル: revaluationretsum.php プロジェクト: Niqpue/zippyerp
 public function generateReport()
 {
     $header = array('date' => date('d.m.Y', $this->document_date), "document_number" => $this->document_number, "summa" => H::fm($this->headerdata['summa']), "actual" => H::fm($this->headerdata['actual']), "storename" => $this->headerdata['storename']);
     switch ($this->headerdata['type']) {
         case 1:
             $header['typename'] = "Переоценка";
             break;
         case 2:
             $header['typename'] = "Списание недостач";
             break;
         case 3:
             $header['typename'] = "Оприходование излишков";
             break;
     }
     $report = new \ZippyERP\ERP\Report('revaluationretsum.tpl');
     $html = $report->generate($header);
     return $html;
 }
コード例 #18
0
ファイル: invoice.php プロジェクト: Niqpue/zippyerp
 public function generateReport()
 {
     $i = 1;
     $detail = array();
     $total = 0;
     foreach ($this->detaildata as $value) {
         $detail[] = array("no" => $i++, "tovar_name" => $value['itemname'], "measure" => $value['measure_name'], "quantity" => $value['quantity'] / 1000, "price" => H::fm($value['price']), "amount" => H::fm($value['quantity'] / 1000 * $value['price']));
         $total += $value['quantity'] / 1000 * $value['price'];
     }
     $firm = \ZippyERP\System\System::getOptions("firmdetail");
     $f = \ZippyERP\ERP\Entity\MoneyFund::findOne('ftype = 1');
     $bank = \ZippyERP\ERP\Entity\Bank::load($f->bank);
     //  $customer = \ZippyERP\ERP\Entity\Customer::load($this->headerdata["customer"]);
     $header = array('date' => date('d.m.Y', $this->document_date), "firmname" => $firm['name'], "firmcode" => $firm['code'], "account" => $f->bankaccount, "bank" => $bank->bank_name, "mfo" => $bank->mfo, "address" => $firm['city'] . ', ' . $firm['street'], "customername" => $this->headerdata["customername"], "document_number" => $this->document_number, "base" => $this->base, "paydate" => date('d.m.Y', $this->headerdata["payment_date"]), "total" => H::fm($total), "totalnds" => H::fm($total + $this->headerdata["totalnds"]), "summa" => Util::ucfirst(Util::money2str($total + $this->headerdata["nds"] / 100, '.', '')));
     $report = new \ZippyERP\ERP\Report('invoice.tpl');
     $html = $report->generate($header, $detail);
     return $html;
 }
コード例 #19
0
ファイル: cashreceiptout.php プロジェクト: Niqpue/zippyerp
 public function generateReport()
 {
     $header = array('date' => date('d.m.Y', $this->document_date), "document_number" => $this->document_number, "notes" => $this->headerdata['notes'], "amount" => \ZippyERP\ERP\Helper::fm($this->headerdata["amount"]));
     $optype = $this->headerdata['optype'];
     if ($optype == self::TYPEOP_CUSTOMER) {
         $header['optype'] = "Оплата поставщику";
     }
     if ($optype == self::TYPEOP_CASH) {
         $header['optype'] = "В  подотчет";
     }
     if ($optype == self::TYPEOP_BANK) {
         $header['optype'] = "Перечисление на счет";
     }
     $header['opdetail'] = $this->headerdata["opdetailname"];
     $report = new \ZippyERP\ERP\Report('cashreceiptout.tpl');
     $html = $report->generate($header);
     return $html;
 }
コード例 #20
0
ファイル: itemactivity.php プロジェクト: Niqpue/zippyerp
 private function generateReport()
 {
     $store = $this->filter->store->getValue();
     $item = $this->filter->item->getKey();
     $from = $this->filter->from->getDate();
     $to = $this->filter->to->getDate();
     $header = array('datefrom' => date('d.m.Y', $from), 'dateto' => date('d.m.Y', $to), "store" => Store::load($store)->storename, "item" => Item::load($item)->itemname, "measure" => Item::load($item)->measure_name);
     $i = 1;
     $detail = array();
     $conn = \ZCL\DB\DB::getConnect();
     $sql = "\n            SELECT\n              t.*,\n              (SELECT\n                  COALESCE(SUM(u.`quantity`), 0)\n                FROM erp_account_subconto u\n                WHERE u.`document_date` < t.dt\n                AND u.`stock_id` = t.`stock_id`) AS begin_quantity\n            FROM (\n            SELECT\n                st.stock_id,\n                price,\n                DATE(sc.document_date) AS dt,\n                SUM(\n                CASE WHEN quantity > 0 THEN quantity ELSE 0 END) AS obin,\n                SUM(\n                CASE WHEN quantity < 0 THEN 0 - quantity ELSE 0 END) AS obout,\n                GROUP_CONCAT(dc.document_number) AS docs\n              FROM\n               erp_account_subconto  sc join erp_store_stock  st on  sc.stock_id = st.stock_id\n               join erp_document  dc  on sc.document_id = dc.document_id\n\n              WHERE st.item_id = {$item}\n              AND st.store_id = {$store}\n              AND DATE(sc.document_date) >= " . $conn->DBDate($from) . "\n              AND DATE(sc.document_date) <= " . $conn->DBDate($to) . "\n              GROUP BY st.stock_id,\n                       st.price,\n                       DATE(sc.document_date)) t\n            ORDER BY dt\n        ";
     $rs = $conn->Execute($sql);
     foreach ($rs as $row) {
         $detail[] = array("no" => $i++, "date" => date("d.m.Y", strtotime($row['dt'])), "documents" => str_replace(',', '<br>', $row['docs']), "price" => H::fm($row['price']), "in" => $row['begin_quantity'] / 1000, "obin" => $row['obin'] / 1000, "obout" => $row['obout'] / 1000, "out" => ($row['begin_quantity'] + $row['obin'] - $row['obout']) / 1000);
     }
     $report = new \ZippyERP\ERP\Report('itemactivity.tpl');
     $html = $report->generate($header, $detail);
     return $html;
 }
コード例 #21
0
ファイル: cashreceiptin.php プロジェクト: Niqpue/zippyerp
 public function generateReport()
 {
     $header = array('date' => date('d.m.Y', $this->document_date), "document_number" => $this->document_number, "notes" => $this->headerdata['notes'], "amount" => \ZippyERP\ERP\Helper::fm($this->headerdata["amount"]));
     $optype = $this->headerdata['optype'];
     if ($optype == self::TYPEOP_CUSTOMER) {
         $header['optype'] = "Оплата от покупателя";
     }
     if ($optype == self::TYPEOP_CASH) {
         $header['optype'] = "Возврат из подотчета";
     }
     if ($optype == self::TYPEOP_BANK) {
         $header['optype'] = "Снятие с банковского счета";
     }
     if ($optype == self::TYPEOP_RET) {
         $header['optype'] = "Выручка   с розницы";
     }
     $header['opdetail'] = $this->headerdata["opdetailname"];
     $report = new \ZippyERP\ERP\Report('cashreceiptin.tpl');
     $html = $report->generate($header);
     return $html;
 }
コード例 #22
0
ファイル: taxinvoice.php プロジェクト: Niqpue/zippyerp
 public function generateReport()
 {
     $i = 1;
     $detail = array();
     $total = 0;
     foreach ($this->detaildata as $value) {
         $detail[] = array("no" => $i++, "date" => "", "tovar_name" => $value['itemname'], "tovar_code" => "", "measure_name" => $value['measure_name'], "measure_code" => $value['measure_code'], "quantity" => $value['quantity'] / 1000, "price" => H::fm($value['price']), "pricends" => H::fm($value['pricends']), "amount" => H::fm($value['quantity'] / 1000 * $value['price']));
         $total += $value['quantity'] / 1000 * $value['price'];
     }
     $firm = System::getOptions("firmdetail");
     $customer = \ZippyERP\ERP\Entity\Customer::load($this->headerdata["customer"]);
     $contract = Document::load($this->headerdata["contract"]);
     if ($contract instanceof Document) {
         $contractnumber = $contract->document_number;
         $contractname = $contract->meta_desc;
         $contractdate = date('dmY', $contract->document_date);
     }
     $header = array('date' => date('dmY', $this->document_date), "firmname" => $firm['name'], "firmcode" => H::addSpaces($firm['inn']), "customername" => $customer->customer_name, "customercode" => H::addSpaces($customer->inn), "saddress" => $firm['street'] . ',' . $firm['city'], "baddress" => $customer->street . ',' . $customer->city, "sphone" => H::addSpaces($firm['phone']), "bphone" => H::addSpaces($customer->phone), "contractname" => $contractname, "contractdate" => H::addSpaces($contractdate), "contractnumber" => $contractnumber, "paytype" => $this->headerdata["paytype"], "document_number" => $this->document_number, "totalnds" => H::fm($this->headerdata["totalnds"]), "total" => H::fm($total), "totalall" => H::fm($total + $this->headerdata["totalnds"]));
     $report = new \ZippyERP\ERP\Report('taxinvoice.tpl');
     $html = $report->generate($header, $detail);
     return $html;
 }
コード例 #23
0
ファイル: shahmatka.php プロジェクト: Niqpue/zippyerp
 private function generateReport()
 {
     $acclist = Account::find("", "cast(acc_code as char)");
     $detail = array();
     $left = array();
     $top = array('');
     $right = array();
     $bottom = array('Кредит');
     $from = strtotime($this->filter->from->getValue());
     $to = strtotime($this->filter->to->getValue());
     foreach ($acclist as $acc) {
         $data = $acc->getSaldoAndOb($from, $to);
         //получаем остатки  и  обороты  на  период
         $left[] = $acc->acc_code;
         $top[] = $acc->acc_code;
         $right[] = H::fm($data['obdt']);
         $bottom[] = H::fm($data['obct']);
     }
     $top[] = 'Дебет';
     $bottom[] = '';
     $detail[] = $top;
     foreach ($acclist as $acc) {
         $arr = array();
         $data = $acc->getSaldoAndOb($from, $to);
         //получаем остатки  и  обороты  на  период
         $arr[] = $acc->acc_code;
         foreach ($acclist as $acc2) {
             $arr[] = H::fm(Account::getObBetweenAccount($acc->acc_code, $acc2->acc_code, $from, $to));
         }
         $arr[] = H::fm($data['obdt']);
         $detail[] = $arr;
     }
     $detail[] = $bottom;
     $header = array('from' => date('d.m.Y', $from), 'to' => date('d.m.Y', $to), 'size' => count($top) - 1);
     $report = new \ZippyERP\ERP\Report('shahmatka.tpl');
     $html = $report->generate($header, $detail);
     return $html;
 }
コード例 #24
0
ファイル: manualentry.php プロジェクト: Niqpue/zippyerp
 public function generateReport()
 {
     $header = array('date' => date('d.m.Y', $this->document_date), "description" => $this->headerdata["description"], "document_number" => $this->document_number);
     $detail = array();
     $i = 1;
     $arr = array();
     $accarr = unserialize(base64_decode($this->headerdata['entry']));
     foreach ($accarr as $entry) {
         $arr[] = array("no" => $i++, "acc_d" => $entry->acc_d, "acc_c" => $entry->acc_c, "amount" => H::fm($entry->amount));
     }
     $detail['entry'] = $arr;
     //ТМЦ
     $arr = array();
     $itemarr = unserialize(base64_decode($this->headerdata['item']));
     foreach ($itemarr as $item) {
         $op = str_replace('_d', ' Дебет', $item->op);
         $op = str_replace('_c', ' Кредит', $op);
         $arr[] = array("no" => $i++, "opname" => $op, "store_name" => $item->store_name, "item_name" => $item->itemname, "qty" => $item->qty / 1000, "price" => H::fm($item->price), "amount" => H::fm($item->price * ($item->qty / 1000)));
     }
     $detail['item'] = $arr;
     //Сотрудники
     $arr = array();
     $itemarr = unserialize(base64_decode($this->headerdata['emp']));
     foreach ($itemarr as $item) {
         $op = str_replace('_d', ' Дебет', $item->op);
         $op = str_replace('_c', ' Кредит', $op);
         $arr[] = array("no" => $i++, "opname" => $op, "name" => $item->fullname, "amount" => H::fm($item->val));
     }
     $detail['emp'] = $arr;
     //Контрагенты
     $arr = array();
     $itemarr = unserialize(base64_decode($this->headerdata['c']));
     foreach ($itemarr as $item) {
         $op = str_replace('_d', ' Дебет', $item->op);
         $op = str_replace('_c', ' Кредит', $op);
         $arr[] = array("no" => $i++, "opname" => $op, "optype" => $item->type == 1 ? "Покупатель" : "Поставщик", "name" => $item->customer_name, "amount" => H::fm($item->val));
     }
     $detail['c'] = $arr;
     //Денежные  счета
     $arr = array();
     $itemarr = unserialize(base64_decode($this->headerdata['f']));
     foreach ($itemarr as $item) {
         $op = str_replace('_d', ' Дебет', $item->op);
         $op = str_replace('_c', ' Кредит', $op);
         $arr[] = array("no" => $i++, "opname" => $op, "name" => $item->title, "amount" => H::fm($item->val));
     }
     $detail['f'] = $arr;
     $report = new \ZippyERP\ERP\Report('manualentry.tpl');
     $html = $report->generate($header, $detail);
     return $html;
 }
コード例 #25
0
ファイル: accountactivity.php プロジェクト: Niqpue/zippyerp
 private function generateReport()
 {
     $acc = Account::load($this->filter->acc->getValue());
     $from = $this->filter->from->getDate();
     $to = $this->filter->to->getDate();
     $header = array('from' => date('d.m.Y', $from), 'to' => date('d.m.Y', $to), 'acc' => $acc->acc_name);
     $detail = array();
     $conn = \ZCL\DB\DB::getConnect();
     $data = $acc->getSaldoAndOb($from, $to);
     //получаем остатки  и  обороты  на  период
     $sql = "select sum(case when acc_d = {$acc->acc_code} then amount else 0 end )  as ad,\n            sum(case when acc_c = {$acc->acc_code} then amount else 0 end )  as ac ,document_number,document_date\n            from erp_account_entry_view  where ( acc_d ={$acc->acc_code} or acc_c ={$acc->acc_code} ) and document_date >= " . $conn->DBDate($from) . " and document_date <= " . $conn->DBDate($to) . "  group by  document_number,document_date  order  by  document_date            ";
     $rs = $conn->Execute($sql);
     $startdt = $data['startdt'];
     $startct = $data['startct'];
     foreach ($rs as $row) {
         $amount = 0;
         $enddt = 0;
         $endct = 0;
         if ($row['ad'] > 0) {
             $amount = $row['ad'];
             $enddt = $startdt + $row['ad'];
             $endct = $startct;
         }
         if ($row['ac'] > 0) {
             $amount = 0 - $row['ac'];
             $endct = $startct + $row['ac'];
             $enddt = $startdt;
         }
         if ($enddt - $endct > 0) {
             $enddt = $enddt - $endct;
             $endct = 0;
         } else {
             $endct = $endct - $enddt;
             $enddt = 0;
         }
         $detail[] = array("date" => date("d.m.Y", strtotime($row['document_date'])), "doc" => $row['document_number'], "amount" => H::fm($amount), "startdt" => H::fm($startdt), "startct" => H::fm($startct), "enddt" => H::fm($enddt), "endct" => H::fm($endct));
         $startdt = $enddt;
         $startct = $endct;
     }
     $report = new \ZippyERP\ERP\Report('accountactivity.tpl');
     $html = $report->generate($header, $detail);
     return $html;
 }