Skip to content

Commit

Permalink
+ brand
Browse files Browse the repository at this point in the history
  • Loading branch information
leon-mbs committed Jun 27, 2024
1 parent 7488184 commit 55f05d7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
10 changes: 9 additions & 1 deletion www/app/pages/report/predsell.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Zippy\Html\Form\Date;
use Zippy\Html\Form\DropDownChoice;
use Zippy\Html\Form\Form;
use Zippy\Html\Form\TextInput;
use Zippy\Html\Label;
use Zippy\Html\Link\RedirectLink;
use Zippy\Html\Link\ClickLink;
Expand All @@ -30,6 +31,8 @@ public function __construct() {
$this->add(new Form('filter'))->onSubmit($this, 'OnSubmit');
$this->filter->add(new DropDownChoice('cat', $cats, 0));
$this->filter->add(new DropDownChoice('type'));
$this->filter->add(new TextInput('brand'));
$this->filter->brand->setDataList(\App\Entity\Item::getManufacturers());

$this->add(new Panel('detail'))->setVisible(false);

Expand All @@ -55,12 +58,17 @@ private function generateReport() {

$cat = (int)$this->filter->cat->getValue();
$type = (int)$this->filter->type->getValue();
$brand = trim( $this->filter->brand->getText() );
$conn = \ZDB\DB::getConnect();

$tp = " (i.item_type=0 || i.item_type=1 ) ";
if ($type == 1) {
$tp = " (i.item_type=4 || i.item_type=5 ) ";
}
$br = "";
if (strlen($brand)>0) {
$br = " and i.manufacturer= ".$conn->qstr($brand);
}

$onstore = [];
$sql = "select sum(qty) as q,item_id from store_stock where item_id in (select item_id from items where disabled <> 1) group by item_id";
Expand Down Expand Up @@ -105,7 +113,7 @@ private function generateReport() {
join documents_view d on e.document_id = d.document_id
where i.disabled <> 1 and d.meta_name in ('GoodsIssue','TTN','POSCheck','OrderFood','ReturnIssue')
and i.cat_id={$cat} and i.item_id in(select item_id from entrylist_view ee where ee.quantity <0 and ee.document_date < {$m2} )
and {$tp}
and {$tp} {$br}
group by i.item_id,i.itemname,i.item_code
order by i.itemname
";
Expand Down
8 changes: 6 additions & 2 deletions www/templates/pages/report/predsell.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,18 @@ <h3>Прогноз продаж</h3>
<option value="0">Без категорії</option>

</select>

<label for="brand">Бренд </label>

<input autocomplete="off" class="form-control mr-2" zippy="brand"/>

<label for="type">Тип </label>

<select class="form-control mr-2" zippy="type">
<option value="0">Товар</option>
<option value="1">Готова продукція</option>
</select>



<input class="btn btn-outline-primary " type="submit" value="ОК">

</form>
Expand Down

0 comments on commit 55f05d7

Please sign in to comment.