Skip to content

Commit

Permalink
Merge pull request #866 from leon-mbs/dev
Browse files Browse the repository at this point in the history
hotfix
  • Loading branch information
leon-mbs authored Jan 21, 2025
2 parents e9e1008 + 30f4715 commit 070a4a9
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 21 deletions.
13 changes: 4 additions & 9 deletions www/app/entity/doc/transitem.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,16 @@ public function Execute() {
$sc->setStock($fi->stock_id);

$sc->save();
$sum = doubleval($this->headerdata["fromquantity"] * $fi->partion) ;
if ($this->headerdata['toitem'] > 0) {
$ti = Item::load($this->headerdata['toitem']);
$price = H::fqty($this->amount / $this->headerdata["toquantity"]);
$price = H::fa($sum / $this->headerdata["toquantity"]);
$stockto = Stock::getStock($this->headerdata['tostore'], $ti->item_id, $price, "", "", true);
$sc = new Entry($this->document_id, $this->headerdata["toquantity"] * $price, $this->headerdata["toquantity"]);
$sc->setStock($stockto->stock_id);
$sc->save();
}
if ($this->headerdata['tostock'] > 0) { // перемещение партии
$stockto = Stock::load($this->headerdata['tostock']);
$sc = new Entry($this->document_id, $this->headerdata["toquantity"] * $stockto->partion, $this->headerdata["toquantity"]);
$sc->setStock($stockto->stock_id);
$sc->save();
}



return true;
}
Expand All @@ -50,7 +45,7 @@ public function generateReport() {
$fi = Item::load($si->item_id);
$ti = Item::load($this->headerdata['toitem']);

if ($this->headerdata['tostock'] > 0) { // перемещение партии
if (($this->headerdata['tostock'] ??0)> 0) { // перемещение партии
$ts = Stock::load($this->headerdata['tostock']);
$ti = Item::load($ts->item_id);
}
Expand Down
5 changes: 5 additions & 0 deletions www/app/pages/doc/transitem.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,12 @@ private function checkForm() {

$this->setError("Однакові ТМЦ");
}
$st= Stock::load($this->_doc->headerdata['fromitem']) ;
if ($this->_doc->headerdata['fromquantity'] > $st->qty ) {

$this->setError(" Недостатньо ТМЦ на складі");
}

return !$this->isError();
}

Expand Down
19 changes: 16 additions & 3 deletions www/app/pages/menulist.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ public function __construct() {
$this->listpan->filter->add(new CheckBox('frep'))->setChecked(true);
$this->listpan->filter->add(new CheckBox('freg'))->setChecked(true);
$this->listpan->filter->add(new CheckBox('fser'))->setChecked(true);

$conn = \ZDB\DB::getConnect() ;
$gr=$conn->GetCol(" select distinct menugroup from metadata where coalesce(menugroup,'') <>'' order by menugroup ") ;

$this->listpan->filter->add(new DropDownChoice('fgr',$gr,'all'));

$this->listpan->add(new ClickLink('addnew'))->onClick($this, 'addnewOnClick');
$this->listpan->add(new DataView('metarow', $this->metadatads, $this, 'metarowOnRow'))->Reload();
Expand All @@ -57,7 +62,7 @@ public function __construct() {

public function filterOnSubmit($sender) {

$where = "1<>1 ";
$where = "(1<>1 ";
if ($this->listpan->filter->fdoc->isChecked()) {
$where .= " or meta_type = 1";
}
Expand All @@ -70,11 +75,19 @@ public function filterOnSubmit($sender) {
if ($this->listpan->filter->fref->isChecked()) {
$where .= " or meta_type = 4";
}

if ($this->listpan->filter->fser->isChecked()) {
$where .= " or meta_type = 5";
}



$where .= " ) ";

$rg=$this->listpan->filter->fgr->getValue() ;
if($rg != 'all') {
$rgn=$this->listpan->filter->fgr->getValueName() ;
$where .= " and menugroup = '{$rgn}' ";

}
$this->metadatads->setWhere($where);

$this->listpan->metarow->Reload();
Expand Down
6 changes: 3 additions & 3 deletions www/app/pages/report/predsell.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,17 +138,17 @@ private function generateReport() {
if ($rqty > 0) {
$r['qty'] = H::fqty($rqty);

if ($onstore[$r['item_id']] > 0) {
if (($onstore[$r['item_id']]??0 ) > 0) {
$r['onstore'] = H::fqty($onstore[$r['item_id']]);
$rqty = $rqty - $onstore[$r['item_id']]; //на складе
}
if ($inorder[$r['item_id']] > 0) {
if (($inorder[$r['item_id']] ??0 )> 0) {
$rqty = $rqty - $inorder[$r['item_id']]; //заказано
}

$r['tobay'] = $rqty;

if ($minqty[$r['item_id']] > 0) {
if (($minqty[$r['item_id']] ??0 ) > 0) {
$r['tobay'] = $r['tobay'] + $minqty[$r['item_id']]; //плюс минимальное оличество
}
if ($r['tobay'] > 0) {
Expand Down
18 changes: 13 additions & 5 deletions www/templates/pages/menulist.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,36 @@ <h2>Налаштування меню</h2>
<div class="form-check ">

<input class="form-check-input" type="checkbox" zippy="fdoc">
<label class="form-check-label mr-sm-2" for="fdoc">Документи</label>
<label class="form-check-label mr-2" for="fdoc">Документи</label>
</div>

<div class="form-check ">

<input class="form-check-input" type="checkbox" zippy="fref">
<label class="form-check-label mr-sm-2" for="fref">Довідники</label>
<label class="form-check-label mr-2" for="fref">Довідники</label>
</div>
<div class="form-check ">

<input class="form-check-input" type="checkbox" zippy="frep">
<label class="form-check-label mr-sm-2" for="frep">Звіти</label>
<label class="form-check-label mr-2" for="frep">Звіти</label>
</div>
<div class="form-check ">

<input class="form-check-input" type="checkbox" zippy="freg">
<label class="form-check-label mr-sm-2" for="freg">Журнали</label>
<label class="form-check-label mr-2" for="freg">Журнали</label>
</div>
<div class="form-check ">

<input class="form-check-input" type="checkbox" zippy="fser">
<label class="form-check-label mr-sm-2" for="fser">Сервіс</label>
<label class="form-check-label mr-2" for="fser">Сервіс</label>
</div>

<div class="form-group ">
<label class="form-check-label " for="fgr">Група</label>

<select class="form-control mr-2" zippy="fgr">
<option value="all"> Всі </option>
</select>
</div>

<button type="submit" class="btn btn-success ">Оновити</button>
Expand Down
2 changes: 1 addition & 1 deletion www/templates/pages/update.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ <h2>Оновлення</h2>

</small>

<br><br><a zippy="updatesql"><b>Оновити автоматично</b></a>
<br><br><a zippy="updatesql"><b>Оновити структуру БД автоматично</b></a>
<br><small><i class="fa fa-exclamation-triangle"></i>
У випадку помилки з`єднання оновіть спочтаку код, як написано вище потім спробуйте ще раз оновити БД
</small>
Expand Down

0 comments on commit 070a4a9

Please sign in to comment.