Skip to content

Commit

Permalink
hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
leon-mbs committed Mar 23, 2024
1 parent 7360ad2 commit f8185d1
Show file tree
Hide file tree
Showing 9 changed files with 101 additions and 67 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 @@ -99,7 +99,7 @@ public function getRelationBased() {
if($this->payed==0) {
$list['Invoice'] = self::getDesc('Invoice');
}
$list['POSCheck'] = self::getDesc('POSCheck');
// $list['POSCheck'] = self::getDesc('POSCheck');
$list['Task'] = self::getDesc('Task');
$list['TTN'] = self::getDesc('TTN');
$list['Order'] = self::getDesc('Order');
Expand Down
3 changes: 3 additions & 0 deletions www/app/entity/item.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ protected function init() {
$this->cat_id = 0;
$this->item_type = self::TYPE_TOVAR;
$this->msr = "шт";
$this->notes = "";

$this->price = 0;
$this->image_id = 0;
Expand Down Expand Up @@ -69,6 +70,7 @@ protected function afterLoad() {
$this->sef = (string)$xml->sef[0];
$this->url = (string)$xml->url[0];
$this->country = (string)$xml->country[0];
$this->notes = (string)$xml->notes[0];
$reclist = (string)$xml->reclist[0];

if(strlen($reclist) >0) {
Expand Down Expand Up @@ -138,6 +140,7 @@ protected function beforeSave() {
$this->detail .= "<warranty><![CDATA[{$this->warranty}]]></warranty>";
$this->detail .= "<extdata><![CDATA[{$this->extdata}]]></extdata>";
$this->detail .= "<country><![CDATA[{$this->country}]]></country>";
$this->detail .= "<notes><![CDATA[{$this->notes}]]></notes>";
$this->detail .= "<techcard><![CDATA[{$this->techcard}]]></techcard>";

$this->detail .= "<price1>{$this->price1}</price1>";
Expand Down
27 changes: 19 additions & 8 deletions www/app/pages/doc/goodsissue.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,11 @@ public function __construct($docid = 0, $basedocid = 0) {
$this->_doc->headerdata['prepaid'] = abs($basedoc->payamount);
}

if($order->state == Document::STATE_INPROCESS) {
$order->updateStatus(Document::STATE_READYTOSHIP);
}


if($order->headerdata['store']>0) {
$this->docform->store->setValue($order->headerdata['store']);
$order->unreserve();

}


Expand Down Expand Up @@ -723,17 +722,29 @@ public function savedocOnClick($sender) {
$this->_doc->updateStatus(Document::STATE_WP);
}
if ($this->_doc->parent_id > 0) { //закрываем заказ
$order = Document::load($this->_doc->parent_id);
$order = Document::load($this->_doc->parent_id)->cast();

if($this->_changedpos) {
$msg= "В документі {$this->_doc->document_number}, створеному на підставі {$order->document_number}, користувачем ".\App\System::getUser()->username." змінено перелік ТМЦ " ;
\App\Entity\Notify::toSystemLog($msg) ;
}

if($this->_doc->payamount >0 && $order->meta_name =='Order') {
if ($order->state == Document::STATE_READYTOSHIP) {
$order->updateStatus(Document::STATE_CLOSED);
if( $order->meta_name =='Order') {


if($order->state == Document::STATE_INPROCESS || $order->state == Document::STATE_READYTOSHIP) {
$order->updateStatus(Document::STATE_INSHIPMENT);
}

if($this->_doc->payamount >0 ) { //если платим в накладной
if ($order->state == Document::STATE_INSHIPMENT) {
$order->updateStatus(Document::STATE_CLOSED);
}
}



$order->unreserve();
}
}
} else {
Expand Down
96 changes: 47 additions & 49 deletions www/app/pages/doc/ttn.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public function __construct($docid = 0, $basedocid = 0) {

if($order->headerdata['store']>0) {
$this->docform->store->setValue($order->headerdata['store']);
$order->unreserve();

}


Expand Down Expand Up @@ -643,12 +643,42 @@ public function savedocOnClick($sender) {
$this->_basedocid = 0;
}
$this->_doc->save();
if ($sender->id == 'execdoc') {

if ($sender->id == 'execdoc' ||$sender->id == 'senddoc' || $sender->id == 'sendnp') {




if (!$isEdited) {
$this->_doc->updateStatus(Document::STATE_NEW);
}



if ($this->_doc->parent_id > 0) {
$basedoc = Document::load($this->_doc->parent_id)->cast();

if($this->_changedpos) {
if($this->_changedpos) {
$msg= "У документа {$this->_doc->document_number}, створеного на підставі {$basedoc->document_number}, користувачем ".\App\System::getUser()->username." змінено перелік ТМЦ " ;
\App\Entity\Notify::toSystemLog($msg) ;
}

}

if( $basedoc->meta_name =='Order') {


if($basedoc->state == Document::STATE_INPROCESS || $basedoc->state == Document::STATE_READYTOSHIP) {
$basedoc->updateStatus(Document::STATE_INSHIPMENT);
}


$basedoc->unreserve();
}

}

// проверка на минус в количестве
$allowminus = System::getOption("common", "allowminus");
if ($allowminus != 1) {
Expand All @@ -660,55 +690,23 @@ public function savedocOnClick($sender) {
return;
}
}
}

if ($this->_doc->parent_id > 0) {
$basedoc = Document::load($this->_doc->parent_id);

if($this->_changedpos) {
if($this->_changedpos) {
$msg= "У документа {$this->_doc->document_number}, створеного на підставі {$basedoc->document_number}, користувачем ".\App\System::getUser()->username." был изменен список ТМЦ " ;
\App\Entity\Notify::toSystemLog($msg) ;
}

}
}

}
$this->_doc->updateStatus(Document::STATE_EXECUTED);


}


if ($sender->id == 'execdoc') {
$this->_doc->updateStatus(Document::STATE_READYTOSHIP);
} else {
if ($sender->id == 'senddoc' || $sender->id == 'sendnp') {


if (!$isEdited) {
$this->_doc->updateStatus(Document::STATE_NEW);
}


if ($this->_doc->parent_id > 0) {
$basedoc = Document::load($this->_doc->parent_id);

if($this->_changedpos) {
$msg= "У документа {$this->_doc->document_number}, створеного на підставі {$basedoc->document_number}, користувачем ".\App\System::getUser()->username." был изменен список ТМЦ " ;

\App\Entity\Notify::toSystemLog($msg) ;

}
}


$this->_doc->updateStatus(Document::STATE_EXECUTED);
if ($sender->id == 'senddoc') {
$this->_doc->updateStatus(Document::STATE_INSHIPMENT);
}
if ($sender->id == 'sendnp') {
$this->_doc->updateStatus(Document::STATE_READYTOSHIP);
}
// $this->_doc->headerdata['sent_date'] = time();
// $this->_doc->save();
} else {
$this->_doc->updateStatus($isEdited ? Document::STATE_EDITED : Document::STATE_NEW);
}
} else if ($sender->id == 'senddoc') {
$this->_doc->updateStatus(Document::STATE_INSHIPMENT);
}
else if ($sender->id == 'sendnp') {
$this->_doc->updateStatus(Document::STATE_READYTOSHIP);
}
else {
$this->_doc->updateStatus($isEdited ? Document::STATE_EDITED : Document::STATE_NEW);
}


Expand Down
4 changes: 4 additions & 0 deletions www/app/pages/reference/itemlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ public function __construct($add = false) {
$this->itemdetail->add(new TextInput('editcell'));
$this->itemdetail->add(new TextInput('edituktz'));
$this->itemdetail->add(new TextInput('editmsr'));
$this->itemdetail->add(new TextInput('editnotes'));

$this->itemdetail->add(new DropDownChoice('editcat', Category::findArray("cat_name", "cat_id not in (select coalesce(parent_id,0) from item_cat )", "cat_name"), 0));
$this->itemdetail->add(new TextInput('editcode'));
Expand Down Expand Up @@ -287,6 +288,7 @@ public function editOnClick($sender) {
$this->itemdetail->editcode->setText($this->_item->item_code);
$this->itemdetail->editbarcode->setText($this->_item->bar_code);
$this->itemdetail->editmsr->setText($this->_item->msr);
$this->itemdetail->editnotes->setText($this->_item->notes);
$this->itemdetail->editmaxsize->setText($this->_item->maxsize);
$this->itemdetail->editvolume->setText($this->_item->volume);
$this->itemdetail->editlost->setText($this->_item->lost);
Expand Down Expand Up @@ -333,6 +335,7 @@ public function addOnClick($sender) {
// Очищаем форму
$this->itemdetail->clean();
$this->itemdetail->editmsr->setText('шт');
$this->itemdetail->editnotes->setText('');
$this->itemdetail->editimage->setVisible(false);
$this->itemdetail->editdelimage->setVisible(false);
$this->itemdetail->editnoprice->setChecked(false);
Expand Down Expand Up @@ -396,6 +399,7 @@ public function save($sender) {
$this->_item->bar_code = trim($this->itemdetail->editbarcode->getText());
$this->_item->url = trim($this->itemdetail->editurl->getText());
$this->_item->msr = $this->itemdetail->editmsr->getText();
$this->_item->notes = $this->itemdetail->editnotes->getText();
$this->_item->weight = $this->itemdetail->editweight->getText();
$this->_item->maxsize = $this->itemdetail->editmaxsize->getText();
$this->_item->volume = $this->itemdetail->editvolume->getText();
Expand Down
1 change: 1 addition & 0 deletions www/app/pages/report/price.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ private function generateReport() {
"cat" => $item->cat_name,
"brand" => $item->manufacturer,
"msr" => $item->msr,
"notes" => $item->notes,
"qty" => \App\Helper::fqty($qty),
"price1" => $isp1 ? $item->getPrice('price1') : "",
"price2" => $isp2 ? $item->getPrice('price2') : "",
Expand Down
10 changes: 9 additions & 1 deletion www/app/pages/service/armpos.php
Original file line number Diff line number Diff line change
Expand Up @@ -1250,7 +1250,7 @@ public function savedocOnClick($sender) {

$exeparent=false; //списано в редительском
if($this->_doc->parent_id >0) {
$bd = Document::load($this->_doc->parent_id);
$bd = Document::load($this->_doc->parent_id)->cast();
$bd->payamount = 0;
$bd->payed = 0;
$bd->save();
Expand All @@ -1262,6 +1262,14 @@ public function savedocOnClick($sender) {
$exeparent=true;

}

if ($bd->meta_name == 'Order' ) {
if($bd->state == Document::STATE_INPROCESS || $bd->state == Document::STATE_READYTOSHIP) {
$bd->updateStatus(Document::STATE_INSHIPMENT);
}
$bd->unreserve();
}

}

// проверка на минус в количестве
Expand Down
21 changes: 14 additions & 7 deletions www/templates/pages/reference/itemlist.html
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,12 @@ <h4>Редагування </h4>
</div>



<div class="form-group row">
<label class="col-5 col-form-label" for="editmsr">Од. виміру</label>
<div class="col-7">
<input class="form-control" zippy="editmsr"/>
</div>
</div>


<div class="form-group row">
Expand Down Expand Up @@ -326,12 +331,7 @@ <h4>Редагування </h4>
<input autocomplete="on" class="form-control" zippy="editcountry"/>
</div>
</div>
<div class="form-group row">
<label class="col-5 col-form-label" for="editmsr">Од. виміру</label>
<div class="col-7">
<input class="form-control" zippy="editmsr"/>
</div>
</div>

<div class="form-group row">
<label class="col-5 col-form-label" for="edituktz">УКТЗЕД</label>
<div class="col-7">
Expand Down Expand Up @@ -423,6 +423,13 @@ <h4>Редагування </h4>

</div>
</div>
<div class="form-group row">
<label class="col-5 col-form-label" for="editnotes">Примітка</label>
<div class="col-7">
<input class="form-control" zippy="editnotes"/>
</div>
<small>Наприклад для прайсу</small>
</div>
<div class="form-group row">
<label class="col-5 col-form-label" for="editdescription">Опис</label>
<div class="col-7">
Expand Down
4 changes: 3 additions & 1 deletion www/templates/printforms/report/price.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@
{{#price4name}} <th align="right">{{price4name}}</th> {{/price4name}}
{{#price5name}} <th align="right">{{price5name}}</th> {{/price5name}}
{{#showdesc}} <th align="right">Опис</th>{{/showdesc}}
<th>Примітка</th>
</tr>
{{#_detail}}
<tr>

<td>{{name}}</td>
<td>{{code}}</td>
<td>{{msr}}</td>

{{#iscat}} <td>{{cat}}</td> {{/iscat}}
{{#isbrand}} <td>{{brand}}</td> {{/isbrand}}
{{#showqty}} <td align="right">{{qty}}</td> {{/showqty}}
Expand All @@ -52,7 +54,7 @@
{{#price4name}} <td align="right">{{price4}}</td> {{/price4name}}
{{#price5name}} <td align="right">{{price5}}</td> {{/price5name}}
{{#showdesc}} <td>{{desc}}</td>{{/showdesc}}

<td>{{notes}}</td>
</tr>
{{/_detail}}
</table>
Expand Down

0 comments on commit f8185d1

Please sign in to comment.