Beispiel #1
0
 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;
 }
Beispiel #2
0
 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;
 }
Beispiel #3
0
 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;
 }
Beispiel #4
0
 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;
 }
Beispiel #5
0
 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;
 }
Beispiel #6
0
 public function __construct()
 {
     parent::__construct();
     $this->add(new Form('detail'));
     $this->detail->add(new TextInput('name'));
     $this->detail->add(new TextInput('edrpou'));
     $this->detail->add(new TextInput('koatuu'));
     $this->detail->add(new TextInput('kopfg'));
     $this->detail->add(new TextInput('kodu'));
     $this->detail->add(new TextInput('kved'));
     $this->detail->add(new TextInput('gni'));
     $this->detail->add(new TextInput('inn'));
     $this->detail->add(new TextInput('city'));
     $this->detail->add(new TextInput('street'));
     $this->detail->add(new TextInput('phone'));
     $this->detail->add(new TextInput('manager'));
     $this->detail->add(new TextInput('accounter'));
     $this->detail->add(new TextInput('email'));
     $this->detail->add(new DropDownChoice('bank', \ZippyERP\ERP\Entity\Bank::findArray('bank_name', '', 'bank_name')));
     $this->detail->add(new TextInput('bankaccount'));
     $this->detail->add(new SubmitButton('detailsave'))->setClickHandler($this, 'saveDetailOnClick');
     $this->add(new Form('common'));
     $this->common->add(new Date('closeddate'));
     $this->common->add(new TextInput('nds'));
     $this->common->add(new CheckBox('hasnds'));
     $this->common->add(new CheckBox('simpletax'));
     $this->common->add(new CheckBox('juridical'));
     $this->common->add(new SubmitButton('commonsave'))->setClickHandler($this, 'saveCommonOnClick');
     $detail = \ZippyERP\System\System::getOptions("firmdetail");
     if (!is_array($detail)) {
         $detail = array();
     }
     $this->detail->name->setText($detail['name']);
     $this->detail->edrpou->setText($detail['edrpou']);
     $this->detail->koatuu->setText($detail['koatuu']);
     $this->detail->kopfg->setText($detail['kopfg']);
     $this->detail->kodu->setText($detail['kodu']);
     $this->detail->kved->setText($detail['kved']);
     $this->detail->gni->setText($detail['gni']);
     $this->detail->inn->setText($detail['inn']);
     $this->detail->city->setText($detail['city']);
     $this->detail->street->setText($detail['street']);
     $this->detail->manager->setText($detail['manager']);
     $this->detail->accounter->setText($detail['accounter']);
     $this->detail->phone->setText($detail['phone']);
     $this->detail->email->setText($detail['email']);
     $f = \ZippyERP\ERP\Entity\MoneyFund::findOne('ftype = 1');
     if ($f != null) {
         $this->detail->bank->setValue($f->bank);
         $this->detail->bankaccount->setText($f->bankaccount);
     }
     $common = \ZippyERP\System\System::getOptions("common");
     if (!is_array($common)) {
         $common = array();
     }
     $this->common->closeddate->setDate($common['closeddate']);
     $this->common->nds->setText($common['nds']);
     $this->common->hasnds->setChecked($common['hasnds']);
     $this->common->simpletax->setChecked($common['simpletax']);
     $this->common->juridical->setChecked($common['juridical']);
 }
Beispiel #7
0
 /**
  * Возвращает  НДС
  * 
  * @param mixed $revert   возвращает  обратную  величину (наприме  если   20% (0.2)  возвращает 16.67% (0.1667) )
  */
 public static function nds($revert = false)
 {
     $common = System::getOptions("common");
     //
     $nds = $common['nds'] / 100;
     if ($revert) {
         $nds = 1 - 100 / (100 + $common['nds']);
     }
     return $nds;
 }
Beispiel #8
0
 /**
  * Експорт  в  ГНАУ  формат XML
  */
 public function export($type)
 {
     $common = System::getOptions("common");
     $firm = System::getOptions("firmdetail");
     $jf = ($common['juridical'] == true ? "J" : "F") . "1201004";
     $edrpou = (string) sprintf("%10d", $firm['edrpou']);
     //2301 0011111111 F1201004 1 00 0000045 1 03 2015 2301.xml
     $number = (string) sprintf('%07d', 1);
     $filename = $firm['gni'] . $edrpou . $jf . "100{$number}1" . date('mY', $this->document_date) . $firm['gni'] . ".xml";
     $filename = str_replace(' ', '0', $filename);
     $customer = \ZippyERP\ERP\Entity\Customer::load($this->headerdata["customer"]);
     $xml = '<?xml version="1.0" encoding="windows-1251"?>';
     $xml .= '<DECLAR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="' . $jf . '.xsd">';
     $xml .= "<DECLARHEAD>";
     $xml .= "<TIN>{$firm['edrpou']}</TIN>";
     $xml .= "<C_DOC>J12</C_DOC>";
     $xml .= "<C_DOC_SUB>010</C_DOC_SUB> ";
     $xml .= "<C_DOC_VER>4</C_DOC_VER>";
     $xml .= "<C_DOC_TYPE>0</C_DOC_TYPE>";
     $xml .= "<C_DOC_CNT>1</C_DOC_CNT>";
     $xml .= "<C_REG>" . substr($firm['gni'], 0, 2) . "</C_REG> ";
     $xml .= "<C_RAJ>" . substr($firm['gni'], 2, 2) . "</C_RAJ>";
     $xml .= "<PERIOD_MONTH>" . date(m) . "</PERIOD_MONTH>";
     $xml .= "<PERIOD_TYPE>1</PERIOD_TYPE>";
     $xml .= "<PERIOD_YEAR>" . date('Y') . "</PERIOD_YEAR>";
     $xml .= "<C_STI_ORIG>{$firm['gni']}</C_STI_ORIG>";
     $xml .= "<C_DOC_STAN>1</C_DOC_STAN>";
     $xml .= "<D_FILL>" . (string) date('dmY') . "</D_FILL>";
     $xml .= "<SOFTWARE>Zippy ERP</SOFTWARE>";
     $xml .= "</DECLARHEAD>";
     $xml .= "<DECLARBODY>";
     $xml .= "<HORIG>1</HORIG>";
     $xml .= "<HFILL>" . (string) date('dmY', $this->document_date) . "</HFILL>";
     $xml .= "<HNUM>" . $this->document_number . "</HNUM>";
     $xml .= "<HNAMESEL>{$firm['name']}</HNAMESEL>";
     $xml .= "<HKSEL>{$firm['inn']}</HKSEL>";
     $xml .= "<HLOCSEL>" . $firm['city'] . " " . $firm['street'] . "</HLOCSEL>";
     if (strlen($firm['phone']) > 0) {
         $xml .= "<HTELSEL>{$firm['phone']}</HTELSEL>";
     }
     $xml .= "<HNAMEBUY>{$customer->customer_name}</HNAMEBUY>";
     $xml .= "<HKBUY>{$customer->inn}</HKBUY>";
     $address = strlen($customer->laddress) > 0 ? $customer->laddress : $customer->faddress;
     $xml .= "<HLOCBUY>{$address}</HLOCBUY>";
     if (strlen($this->headerdata['based']) > 0) {
         $xml .= "<H01G1S>{$this->headerdata['based']}</H01G1S>";
     }
     if (strlen($this->headerdata['ernn']) == true) {
         $xml .= "<HERPN>true</HERPN>";
     }
     $num = 0;
     foreach ($this->detaildata as $value) {
         $num++;
         $xml .= "<RXXXXG4S ROWNUM=\"{$num}\">{$value['measure_name']}</RXXXXG4S>";
         $xml .= "<RXXXXG105_2S  ROWNUM=\"{$num}\">{$value['measure_code']}</RXXXXG105_2S>";
         if (strlen($value['uktzed'] > 0)) {
             $xml .= "<RXXXXG4  ROWNUM=\"{$num}\">{$value['uktzed']}</RXXXXG4>";
         }
         $xml .= "<RXXXXG3S ROWNUM=\"{$num}\">{$value['itemname']}</RXXXXG3S>";
         $xml .= "<RXXXXG5  ROWNUM=\"{$num}\">{$value['quantity']}</RXXXXG5>";
         $xml .= "<RXXXXG6  ROWNUM=\"{$num}\">" . H::fm($value['price']) . "</RXXXXG6>";
         $xml .= "<RXXXXG7  ROWNUM=\"{$num}\">" . H::fm($value['quantity'] * $value['price']) . "</RXXXXG7>";
     }
     $total = H::fm($this->headerdata["total"]);
     $totalnds = H::fm($this->headerdata["totalnds"]);
     $all = $total + $totalnds;
     $xml .= "<R01G7>" . ($total - $totalnds) . "</R01G7>";
     $xml .= "<R01G11>{$total}</R01G11>";
     $xml .= "<R03G7>{$totalnds}</R03G7>";
     $xml .= "<R03G11>{$totalnds}</R03G11>";
     $xml .= "<R04G7>" . $total . "</R04G7>";
     $xml .= "<R04G11>" . $total . "</R04G11>";
     $xml .= "</DECLARBODY>";
     $xml .= "</DECLAR>";
     $xml = iconv("UTF-8", "WINDOWS-1251", $xml);
     return array("filename" => $filename, "content" => $xml);
 }