Skip to content

Commit

Permalink
next
Browse files Browse the repository at this point in the history
  • Loading branch information
leon-mbs committed Feb 4, 2022
1 parent e88fdf1 commit 2406d3c
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 24 deletions.
2 changes: 1 addition & 1 deletion www/app/entity/doc/order.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function getRelationBased() {
$list = array();
$list['GoodsIssue'] = self::getDesc('GoodsIssue');
$list['ProdReceipt'] = self::getDesc('ProdReceipt');
$list['Invoice'] = self::getDesc('Invoice');
if($this->payed==0) $list['Invoice'] = self::getDesc('Invoice');
$list['POSCheck'] = self::getDesc('POSCheck');
$list['Task'] = self::getDesc('Task');
$list['TTN'] = self::getDesc('TTN');
Expand Down
24 changes: 12 additions & 12 deletions www/app/pages/doc/goodsissue.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,20 +209,13 @@ public function __construct($docid = 0, $basedocid = 0) {
$this->_itemlist = $basedoc->unpackDetails('detaildata');
// $this->calcTotal();
$this->calcPay();
$this->_doc->headerdata['prepaid'] = abs($basedoc->getPayAmount());

if ($order->headerdata['payment'] > 0) {
$this->docform->payment->setValue(0); // предоплата
$this->docform->editpayed->setText(H::fa(0));
$this->docform->payed->setText(H::fa(0));
$this->docform->editpayamount->setText(H::fa(0));
$this->docform->payamount->setText(H::fa(0));
$this->docform->editpaydisc->setText(H::fa(0));
$this->docform->paydisc->setText(H::fa(0));
} else {
$this->docform->editpayed->setText($this->docform->editpayamount->getText());
$this->docform->payed->setText($this->docform->payamount->getText());

$this->docform->editpayed->setText($this->docform->editpayamount->getText());
$this->docform->payed->setText($this->docform->payamount->getText());

}



}
Expand All @@ -244,6 +237,7 @@ public function __construct($docid = 0, $basedocid = 0) {
$this->docform->contract->setValue($basedoc->headerdata['contract_id']);
$this->docform->editpaydisc->setText($basedoc->headerdata['paydisc']);
$this->docform->paydisc->setText($basedoc->headerdata['paydisc']);
$this->_doc->headerdata['prepaid'] = abs($basedoc->getPayAmount());

$this->_itemlist = $basedoc->unpackDetails('detaildata');
$this->calcTotal();
Expand Down Expand Up @@ -308,6 +302,8 @@ public function __construct($docid = 0, $basedocid = 0) {
}
}
}

$this->_tvars["prepaid"] = (doubleval($this->_doc->headerdata['prepaid'])>0) ? H::fa($this->_doc->headerdata['prepaid']) : false;

$this->docform->add(new DataView('detail', new \Zippy\Html\DataList\ArrayDataSource(new \Zippy\Binding\PropertyBinding($this, '_itemlist')), $this, 'detailOnRow'))->Reload();
if (false == \App\ACL::checkShowDoc($this->_doc)) {
Expand Down Expand Up @@ -733,10 +729,14 @@ private function calcTotal() {
private function calcPay() {
$total = $this->docform->total->getText();
$disc = $this->docform->paydisc->getText();
$prepaid = doubleval($this->_doc->headerdata['prepaid'] ) ;

if ($disc > 0) {
$total -= $disc;
}
if ($prepaid > 0) {
$total -= $prepaid;
}

$this->docform->editpayamount->setText(H::fa($total));
$this->docform->payamount->setText(H::fa($total));
Expand Down
5 changes: 4 additions & 1 deletion www/app/pages/doc/goodsreceipt.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ public function __construct($docid = 0, $basedocid = 0) {

$this->docform->customer->setKey($basedoc->customer_id);
$this->docform->customer->setText($basedoc->customer_name);
$this->docform->val->setValue(0);
$this->docform->rate->setText(1);

$order = $basedoc->cast();
$this->docform->basedoc->setText('Заказ ' . $order->document_number);
Expand Down Expand Up @@ -640,8 +642,9 @@ private function CalcPay() {
$total = $this->docform->total->getText();
$disc = doubleval($this->docform->disc->getText());
$nds = doubleval($this->docform->nds->getText()) ;
$prepaid = doubleval($this->_doc->headerdata['prepaid'] ) ;

$total = $total + $nds - $disc;
$total = $total + $nds - $disc - $prepaid;

if(doubleval( $this->_doc->headerdata['prepaid'])>0) {
$total = $total - $this->_doc->headerdata['prepaid'];
Expand Down
7 changes: 7 additions & 0 deletions www/templates/pages/doc/goodsissue.html
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,13 @@ <h3>Расходная накладная </h3>
<td><a data-label="paydisc" href="javascript:void(0);" data-toggle="modal" data-target="#modaldisc"><i
class="fa fa-edit"></i></a></td>
</tr>
{{#prepaid}}
<tr style="font-weight: bolder;">
<td data-label="prepaid" colspan={{colspan}} class="text-right">Предоплата:</td>
<td class="text-right"> {{prepaid}}</td>
<td> </td>
</tr>
{{/prepaid}}

<tr style="font-weight: bolder;">

Expand Down
10 changes: 5 additions & 5 deletions www/templates/pages/doc/invoicecust.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,32 +105,32 @@ <h3> Счет входящий </h3>
</td>
</tr>
<tr style="font-weight: bolder;">
<td colspan="5" class="text-right">Всего:</td>
<td colspan="6" class="text-right">Всего:</td>
<td zippy="total" class="text-right"></td>
<td></td>
</tr>
<tr style="font-weight: bolder;" id="tankor">
<td data-label="nds" colspan="5" class="text-right">НДС:</td>
<td data-label="nds" colspan="6" class="text-right">НДС:</td>
<td zippy="nds" class="text-right"></td>
<td data-label="nds"><a href="javascript:void(0);" data-toggle="modal" data-target="#modalnds"><i
class="fa fa-edit"></i></a></td>
</tr>
<tr style="font-weight: bolder;">
<td data-label="disc" colspan="5" class="text-right">Скидка:</td>
<td data-label="disc" colspan="6" class="text-right">Скидка:</td>
<td zippy="disc" class="text-right"></td>
<td data-label="disc"><a href="javascript:void(0);" data-toggle="modal" data-target="#modaldisc"><i
class="fa fa-edit"></i></a></td>
</tr>

<tr style="font-weight: bolder;">
<td colspan="5" class="text-right">К оплате:</td>
<td colspan="6" class="text-right">К оплате:</td>
<td zippy="payamount" class="text-right"></td>
<td><a href="javascript:void(0);" data-toggle="modal" data-target="#modalpayamount"><i
class="fa fa-edit"></i></a></td>
</tr>

<tr style="font-weight: bolder;">
<td colspan="5" class="text-right">Внесена оплата:</td>
<td colspan="6" class="text-right">Внесена оплата:</td>
<td zippy="payed" class="text-right"></td>
<td><a href="javascript:void(0);" data-toggle="modal" data-target="#modalpayed"><i
class="fa fa-edit"></i></a></td>
Expand Down
8 changes: 8 additions & 0 deletions www/templates_ua/pages/doc/goodsissue.html
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,14 @@ <h3>Видаткова накладна </h3>
<td><a data-label="paydisc" href="javascript:void(0);" data-toggle="modal" data-target="#modaldisc"><i
class="fa fa-edit"></i></a></td>
</tr>
{{#prepaid}}
<tr style="font-weight: bolder;">
<td data-label="prepaid" colspan={{colspan}} class="text-right">Передплата:</td>
<td zippy="prepaid" class="text-right"></td>
<td> </td>
</tr>
{{/prepaid}}


<tr style="font-weight: bolder;">

Expand Down
10 changes: 5 additions & 5 deletions www/templates_ua/pages/doc/invoicecust.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,32 +106,32 @@ <h3> Рахунок вхідний </h3>
</td>
</tr>
<tr style="font-weight: bolder;">
<td colspan="5" class="text-right">Всього:</td>
<td colspan="6" class="text-right">Всього:</td>
<td zippy="total" class="text-right"></td>
<td></td>
</tr>
<tr style="font-weight: bolder;" id="tankor">
<td data-label="nds" colspan="5" class="text-right">ПДВ:</td>
<td data-label="nds" colspan="6" class="text-right">ПДВ:</td>
<td zippy="nds" class="text-right"></td>
<td data-label="nds"><a href="javascript:void(0);" data-toggle="modal" data-target="#modalnds"><i
class="fa fa-edit"></i></a></td>
</tr>
<tr style="font-weight: bolder;">
<td data-label="disc" colspan="5" class="text-right">Знижка:</td>
<td data-label="disc" colspan="6" class="text-right">Знижка:</td>
<td zippy="disc" class="text-right"></td>
<td data-label="disc"><a href="javascript:void(0);" data-toggle="modal" data-target="#modaldisc"><i
class="fa fa-edit"></i></a></td>
</tr>

<tr style="font-weight: bolder;">
<td colspan="5" class="text-right">До оплати:</td>
<td colspan="6" class="text-right">До оплати:</td>
<td zippy="payamount" class="text-right"></td>
<td><a href="javascript:void(0);" data-toggle="modal" data-target="#modalpayamount"><i
class="fa fa-edit"></i></a></td>
</tr>

<tr style="font-weight: bolder;">
<td colspan="5" class="text-right">Внесена оплата:</td>
<td colspan="6" class="text-right">Внесена оплата:</td>
<td zippy="payed" class="text-right"></td>
<td><a href="javascript:void(0);" data-toggle="modal" data-target="#modalpayed"><i
class="fa fa-edit"></i></a></td>
Expand Down

0 comments on commit 2406d3c

Please sign in to comment.