예제 #1
0
 public function __construct($docid = 0)
 {
     parent::__construct();
     $this->add(new Form('docform'));
     $this->docform->add(new TextInput('document_number'));
     $this->docform->add(new TextInput('amount'));
     $this->docform->add(new Date('created', time()));
     $this->docform->add(new DropDownChoice('customer', Customer::findArray("customer_name", "")));
     $this->docform->add(new Date('startdate', time()));
     $this->docform->add(new Date('enddate', time()));
     $this->docform->add(new TextArea('description'));
     $this->docform->add(new SubmitButton('submit'))->setClickHandler($this, 'submitOnClick');
     $this->docform->add(new Button('cancel'))->setClickHandler($this, 'cancelOnClick');
     if ($docid > 0) {
         //загружаем   содержимок  документа настраницу
         $this->_doc = Document::load($docid);
         $this->docform->document_number->setText($this->_doc->document_number);
         $this->docform->created->setDate($this->_doc->document_date);
         $this->docform->startdate->setDate($this->_doc->headerdata['startdate']);
         $this->docform->enddate->setDate($this->_doc->headerdata['enddate']);
         $this->docform->description->setText($this->_doc->headerdata['description']);
         $this->docform->amount->setText(H::fm($this->_doc->headerdata['amount']));
         $this->docform->customer->setValue($this->_doc->headerdata['customer']);
     } else {
         $this->_doc = Document::create('Contract');
         $this->docform->document_number->setText($this->_doc->nextNumber());
     }
 }
예제 #2
0
 public function dlistOnRow($row)
 {
     $item = $row->getDataItem();
     $row->add(new Label('amount', H::fm($item->amount)));
     $row->add(new Label('ddate', date('Y-m-d', $item->document_date)));
     $row->add(new ClickLink('ddoc', $this, 'ddocOnClick'))->setValue($item->description . ' ' . $item->document_number);
 }
예제 #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
 public function doclistOnRow($row)
 {
     $item = $row->getDataItem();
     $item = $item->cast();
     $row->add(new Label('name', $item->meta_desc));
     $row->add(new Label('number', $item->document_number));
     $row->add(new Label('date', date('d-m-Y', $item->document_date)));
     $row->add(new Label('amount', $item->amount > 0 ? H::fm($item->amount) : ""));
     $row->add(new Label('ernn'))->setVisible($item->headerdata['ernn'] == true);
     $row->add(new ClickLink('show'))->setClickHandler($this, 'showOnClick');
     $row->add(new ClickLink('edit'))->setClickHandler($this, 'editOnClick');
     $row->add(new ClickLink('cancel'))->setClickHandler($this, 'cancelOnClick');
     if ($item->state == Document::STATE_CLOSED) {
         $row->edit->setVisible(false);
         $row->cancel->setVisible(true);
     } else {
         $row->edit->setVisible(true);
         $row->cancel->setVisible(false);
     }
     //закрытый период
     if ($item->updated < strtotime("2013-01-01")) {
         $row->edit->setVisible(false);
         $row->cancel->setVisible(false);
     }
 }
예제 #5
0
 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;
 }
예제 #6
0
 public function entrylistOnRow($row)
 {
     $item = $row->getDataItem();
     $row->add(new Label('acc_d', $item->acc_d));
     $row->add(new Label('acc_c', $item->acc_c));
     $row->add(new Label('amount', $item->amount > 0 ? H::fm($item->amount) : ""));
     $row->add(new Label('created', date('d-m-Y', $item->document_date)));
     $row->add(new ClickLink('show', $this, 'showOnClick'))->setValue($item->meta_desc . ' ' . $item->document_number);
 }
예제 #7
0
 public function listOnRow($row)
 {
     $item = $row->getDataItem();
     $row->add(new Label('code', $item->acc_code));
     $row->add(new Label('name', $item->acc_name));
     $saldo = $item->getSaldo();
     $row->add(new Label('dt', $saldo > 0 ? H::fm($saldo) : ""));
     $row->add(new Label('ct', $saldo < 0 ? H::fm(0 - $saldo) : ""));
 }
예제 #8
0
파일: stock.php 프로젝트: Niqpue/zippyerp
 /**
  * Метод  для   получения  имени  ТМЦ  с  ценой
  *
  * @param mixed $criteria
  * @return []
  * @static
  */
 public static function findArrayEx($criteria = "", $orderbyfield = null, $orderbydir = null, $count = -1, $offset = -1)
 {
     $entitylist = self::find($criteria, $orderbyfield, $orderbydir, $count, $offset);
     $list = array();
     foreach ($entitylist as $key => $value) {
         $list[$key] = $value->itemname . ', ' . \ZippyERP\ERP\Helper::fm($value->price);
     }
     return $list;
 }
예제 #9
0
 public function detailOnRow($row)
 {
     $item = $row->getDataItem();
     $row->add(new Label('item', $item->itemname));
     $row->add(new Label('measure', $item->measure_name));
     $row->add(new Label('quantity', $item->quantity / 1000));
     $row->add(new Label('price', H::fm($item->price)));
     $row->add(new ClickLink('edit'))->setClickHandler($this, 'editOnClick');
     $row->add(new ClickLink('delete'))->setClickHandler($this, 'deleteOnClick');
 }
예제 #10
0
 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;
 }
예제 #11
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;
 }
예제 #12
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;
 }
예제 #13
0
 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;
 }
예제 #14
0
 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;
 }
예제 #15
0
 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;
 }
예제 #16
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'];
     }
     $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;
 }
예제 #17
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;
 }
예제 #18
0
 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;
 }
예제 #19
0
 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;
 }
예제 #20
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;
 }
예제 #21
0
 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;
 }
예제 #22
0
파일: item.php 프로젝트: Niqpue/zippyerp
 /**
  * передает  данные для  редактирования
  * 
  * @param mixed $item
  */
 public function open(\ZippyERP\ERP\Entity\Item $item = null)
 {
     if ($item == null) {
         $item = new \ZippyERP\ERP\Entity\Item();
     }
     $this->item = $item;
     $this->itemdetail->editname->setText($this->item->itemname);
     $this->itemdetail->editpriceret->setText(H::fm($this->item->priceret));
     $this->itemdetail->editpriceopt->setText(H::fm($this->item->priceopt));
     $this->itemdetail->editdescription->setText($this->item->description);
     $this->itemdetail->editcode->setText($this->item->code);
     $this->itemdetail->edituktzed->setText($this->item->uktzed);
     $this->itemdetail->editbarcode->setText($this->item->barcode);
     $this->itemdetail->editmeasure->setValue($this->item->measure_id);
     $this->itemdetail->editgroup->setValue($this->item->group_id);
     $this->itemdetail->edittype->setValue($this->item->item_type);
     $this->setVisible(true);
 }
예제 #23
0
 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;
 }
예제 #24
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;
 }
예제 #25
0
 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;
 }
예제 #26
0
 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;
 }
예제 #27
0
 public function doclistOnRow($row)
 {
     $item = $row->getDataItem();
     $supplier = Customer::load($item->intattr1);
     $item = $item->cast();
     $row->add(new Label('number', $item->document_number));
     $row->add(new Label('date', date('d-m-Y', $item->document_date)));
     $row->add(new Label('supplier', $supplier ? $supplier->customer_name : ""));
     $row->add(new Label('amount', $item->amount > 0 ? H::fm($item->amount) : ""));
     $row->add(new Label('payment', $item->intattr2 > 0 ? H::fm($item->intattr2) : ""));
     $row->add(new Label('state', Document::getStateName($item->state)));
     $row->add(new ClickLink('show'))->setClickHandler($this, 'showOnClick');
     $row->add(new ClickLink('edit'))->setClickHandler($this, 'editOnClick');
     //закрытый период
     if ($item->updated < strtotime("2013-01-01")) {
         $row->edit->setVisible(false);
         $row->cancel->setVisible(false);
     }
 }
예제 #28
0
 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;
 }
예제 #29
0
파일: doclist.php 프로젝트: Niqpue/zippyerp
 public function doclistOnRow($row)
 {
     $item = $row->getDataItem();
     $item = $item->cast();
     $row->add(new Label('name', $item->meta_desc));
     $row->add(new Label('number', $item->document_number));
     $row->add(new Label('date', date('d-m-Y', $item->document_date)));
     $row->add(new Label('amount', $item->amount > 0 ? H::fm($item->amount) : ""));
     $row->add(new Label('state', Document::getStateName($item->state)));
     // $row->add(new Label('created', date('d-m-Y', $item->created)));
     $row->add(new ClickLink('show'))->setClickHandler($this, 'showOnClick');
     $row->add(new ClickLink('edit'))->setClickHandler($this, 'editOnClick');
     $row->add(new ClickLink('cancel'))->setClickHandler($this, 'cancelOnClick');
     $row->add(new ClickLink('delete'))->setClickHandler($this, 'deleteOnClick');
     $user = System::getUser();
     $row->delete->setVisible($user->userlogin == 'admin' || ($user->user_id = $item->user_id));
     if ($item->state == Document::STATE_EXECUTED || $item->state == Document::STATE_CLOSED) {
         $row->delete->setVisible(false);
         $row->edit->setVisible(false);
         $row->cancel->setVisible(true);
     } else {
         $row->edit->setVisible(true);
         $row->cancel->setVisible(false);
     }
     //спписок документов   которые   могут  быть созданы  на  основании  текущего
     $basedon = $row->add(new Label('basedon'));
     $basedonlist = $item->getRelationBased();
     if (count($basedonlist) == 0) {
         $basedon->setVisible(false);
     } else {
         $list = "";
         foreach ($basedonlist as $doctype => $docname) {
             $list .= "<li><a href=\"/?p=ZippyERP/ERP/Pages/Doc/" . $doctype . "&arg=/0/{$item->document_id}\">{$docname}</a></li>";
         }
         $basedon = $row->add(new Label('basedlist'))->setText($list, true);
     }
     //закрытый период
     if ($item->updated < strtotime("2013-01-01")) {
         $row->edit->setVisible(false);
         $row->cancel->setVisible(false);
     }
 }
예제 #30
0
 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;
 }