public function Execute() { $total = $this->headerdata['total']; $customer_id = $this->headerdata["customer"]; if ($this->headerdata['cash'] == true) { $cash = MoneyFund::getCash(); Entry::AddEntry("63", "30", $total, $this->document_id, $this->document_date); $sc = new SubConto($this, 63, $total); $sc->setCustomer($this->headerdata["customer"]); $sc->save(); $sc = new SubConto($this, 30, $total); $sc->setMoneyfund($cash->id); // $sc->save(); } if ($this->headerdata['totalnds'] > 0) { $total = $total - $this->headerdata['totalnds']; Entry::AddEntry("644", "63", $this->headerdata['totalnds'], $this->document_id, 0, $customer_id); $sc = new SubConto($this, 63, 0 - $this->headerdata['totalnds']); $sc->setCustomer($customer_id); $sc->save(); $sc = new SubConto($this, 644, $this->headerdata['totalnds']); $sc->setExtCode(TAX_NDS); //$sc->save(); } Entry::AddEntry("91", "63", $total, $this->document_id, $this->document_date); $sc = new SubConto($this, 63, 0 - $value); $sc->setCustomer($customer_id); $sc->save(); return true; }
public function Execute() { $conn = \ZCL\DB\DB::getConnect(); $conn->StartTrans(); $total = $this->headerdata['total']; $customer_id = $this->headerdata["customer"]; // \ZippyERP\ERP\Entity\Customer::AddActivity($customer_id, 0 - $total, $this->document_id); if ($this->headerdata['cash'] == true) { $cash = MoneyFund::getCash(); \ZippyERP\ERP\Entity\Entry::AddEntry("30", "36", $total, $this->document_id, $cash->id, $customer_id); $sc = new SubConto($this, 36, 0 - $total); $sc->setCustomer($this->headerdata["customer"]); $sc->save(); $sc = new SubConto($this, 30, $total); $sc->setMoneyfund($cash->id); // $sc->save(); } if ($this->headerdata['totalnds'] > 0) { Entry::AddEntry("703", "643", $this->headerdata['totalnds'], $this->document_id, $this->document_date); } Entry::AddEntry("36", "703", $total, $this->document_id, $this->document_date); $sc = new SubConto($this, 36, $total); $sc->setCustomer($this->headerdata["customer"]); $sc->save(); $conn->CompleteTrans(); return true; }
public function Execute() { foreach ($this->detaildata as $value) { if ($value['noentry'] === 'true') { //не выполнять проводки continue; } if ($value['optype'] == self::OUT) { Entry::AddEntry('63', "31", $value['amount'], $this->document_id, $this->document_date); $sc = new SubConto($this, 63, $value['amount']); $sc->setCustomer($value['customer']); $sc->save(); $sc = new SubConto($this, 31, 0 - $value['amount']); $sc->setMoneyfund($this->headerdata['bankaccount']); $sc->save(); } if ($value['optype'] == self::IN) { Entry::AddEntry('31', "36", $value['amount'], $this->document_id, $this->document_date); $sc = new SubConto($this, 36, 0 - $value['amount']); $sc->setCustomer($value['customer']); $sc->save(); $sc = new SubConto($this, 31, $value['amount']); $sc->setMoneyfund($this->headerdata['bankaccount']); $sc->save(); } if ($value['optype'] == self::TAX) { //Entry::AddEntry('643', "644", $value['amount'], $this->document_id, $this->document_date); Entry::AddEntry('643', "31", $value['amount'], $this->document_id, $this->document_date); $sc = new SubConto($this, 643, $value['amount']); $sc->setCustomer($value['customer']); $sc->save(); $sc = new SubConto($this, 31, 0 - $value['amount']); $sc->setMoneyfund($this->headerdata['bankaccount']); $sc->setExtCode($value['tax']); // код налога $sc->save(); } if ($value['optype'] == self::CASHIN) { $cash = MoneyFund::getCash(); Entry::AddEntry('30', "31", $value['amount'], $this->document_id, $this->document_date); $sc = new SubConto($this, 31, 0 - $value['amount']); $sc->setMoneyfund($this->headerdata['bankaccount']); $sc->save(); } if ($value['optype'] == self::CASHOUT) { $cash = MoneyFund::getCash(); Entry::AddEntry('31', "30", $value['amount'], $this->document_id, $this->document_date); $sc = new SubConto($this, 31, $value['amount']); $sc->setMoneyfund($this->headerdata['bankaccount']); $sc->save(); } // $this->AddConnectedDoc($value['doc']); } }
public function Execute() { $types = array(); //аналитика foreach ($this->detaildata as $item) { $stock = \ZippyERP\ERP\Entity\Stock::getStock($this->headerdata['store'], $item['item_id'], $item['price'], true); $sc = new SubConto($this, $item['type'], $item['amount'] - $item['nds']); $sc->setStock($stock->stock_id); $sc->setQuantity($item['quantity']); $sc->save(); //группируем по синтетическим счетам if ($types[$item['type']] > 0) { $types[$item['type']] = $types[$item['type']] + $item['amount'] - $item['nds']; } else { $types[$item['type']] = $item['amount'] - $item['nds']; } } foreach ($types as $acc => $value) { Entry::AddEntry($acc, "63", $value, $this->document_id, $this->document_date); $sc = new SubConto($this, 63, 0 - $value); $sc->setCustomer($this->headerdata["customer"]); $sc->save(); } $total = $this->headerdata['total']; if ($this->headerdata['cash'] == true) { $cash = MoneyFund::getCash(); Entry::AddEntry("63", "30", $total, $this->document_id, $this->document_date); $sc = new SubConto($this, 63, $total); $sc->setCustomer($this->headerdata["customer"]); $sc->save(); $sc = new SubConto($this, 30, 0 - $total); $sc->setMoneyfund($cash->id); // $sc->save(); } //налоговый кредит if ($this->headerdata['totalnds'] > 0) { Entry::AddEntry("644", "63", $this->headerdata['totalnds'], $this->document_id, $this->document_date); $sc = new SubConto($this, 63, 0 - $this->headerdata['totalnds']); $sc->setCustomer($this->headerdata["customer"]); $sc->save(); $sc = new SubConto($this, 644, $this->headerdata['totalnds']); $sc->setExtCode(TAX_NDS); //$sc->save(); } return true; }