Skip to content

Commit

Permalink
уведосление в кафе
Browse files Browse the repository at this point in the history
  • Loading branch information
leon-mbs committed Jul 7, 2021
1 parent d7c95e8 commit 78c44ba
Show file tree
Hide file tree
Showing 28 changed files with 342 additions and 89 deletions.
4 changes: 2 additions & 2 deletions db/temp.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ALTER TABLE `notifies` CHANGE `user_id` `user_id` INT(11) NULL;


ALTER TABLE `users` ADD `lastactive` DATETIME NULL ;

DROP VIEW users_view ;
Expand Down
5 changes: 5 additions & 0 deletions www/app/entity/notify.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,17 @@
class Notify extends \ZCL\DB\Entity
{

const ARMFOODPROD = -1; //арм кухни
const ARMFOOD = -2; //арм кассира кафе
const DELIV = -3; //журнал доставок

protected function init() {

$this->sender_id = 0;
$this->notify_id = 0;
$this->checked = 0;
$this->user_id = 0;
$this->message = '';
$this->dateshow = time();
}

Expand Down
12 changes: 12 additions & 0 deletions www/app/modules/shop/pages/order.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,18 @@ public function OnSave($sender) {
$order->updateStatus(Document::STATE_EXECUTED);
}



if ($shop['ordertype'] == 2) { //уведомление в арм кухни
$n = new \App\Entity\Notify();
$n->user_id = \App\Entity\Notify::ARMFOOD;
$n->dateshow = time();
$n->message = $order->document_id;

$n->save();
}


$this->setSuccess("shopneworder", $order->document_number);

if (strlen($phone) > 0) {
Expand Down
6 changes: 2 additions & 4 deletions www/app/pages/doc/goodsissue.php
Original file line number Diff line number Diff line change
Expand Up @@ -614,11 +614,9 @@ public function savedocOnClick($sender) {


$conn->CommitTrans();
if ($isEdited) {
App::RedirectBack();
} else {

App::Redirect("\\App\\Pages\\Register\\GIList",$this->_doc->document_id);
}

} catch(\Throwable $ee) {
global $logger;
$conn->RollbackTrans();
Expand Down
3 changes: 2 additions & 1 deletion www/app/pages/doc/goodsreceipt.php
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ public function savedocOnClick($sender) {
}
}

App::Redirect("\\App\\Pages\\Register\\GRList");

$conn->CommitTrans();
} catch(\Throwable $ee) {
Expand All @@ -532,7 +533,7 @@ public function savedocOnClick($sender) {

return;
}
App::RedirectBack();

}

public function onPayAmount($sender) {
Expand Down
3 changes: 2 additions & 1 deletion www/app/pages/doc/prodissue.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Zippy\Html\Form\Form;
use Zippy\Html\Form\SubmitButton;
use Zippy\Html\Form\TextInput;
use Zippy\Html\Form\TextArea;
use Zippy\Html\Label;
use Zippy\Html\Link\ClickLink;
use Zippy\Html\Link\SubmitLink;
Expand All @@ -39,7 +40,7 @@ public function __construct($docid = 0, $basedocid = 0) {

$this->docform->add(new DropDownChoice('store', Store::getList(), H::getDefStore()))->onChange($this, 'OnChangeStore');
$this->docform->add(new DropDownChoice('parea', \App\Entity\Prodarea::findArray("pa_name", ""), 0));
$this->docform->add(new TextInput('notes'));
$this->docform->add(new TextArea('notes'));

$this->docform->add(new SubmitLink('addrow'))->onClick($this, 'addrowOnClick');

Expand Down
6 changes: 4 additions & 2 deletions www/app/pages/doc/prodreceipt.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Zippy\Html\Form\Form;
use Zippy\Html\Form\SubmitButton;
use Zippy\Html\Form\TextInput;
use Zippy\Html\Form\TextArea;
use Zippy\Html\Label;
use Zippy\Html\Link\ClickLink;
use Zippy\Html\Link\SubmitLink;
Expand All @@ -42,7 +43,7 @@ public function __construct($docid = 0, $basedocid = 0) {
$this->docform->add(new DropDownChoice('parea', \App\Entity\Prodarea::findArray("pa_name", ""), 0));
$this->docform->add(new DropDownChoice('store', Store::getList(), H::getDefStore()));

$this->docform->add(new TextInput('notes'));
$this->docform->add(new TextArea('notes'));

$this->docform->add(new SubmitLink('addrow'))->onClick($this, 'addrowOnClick');
$this->docform->add(new Button('backtolist'))->onClick($this, 'backtolistOnClick');
Expand Down Expand Up @@ -288,7 +289,8 @@ public function savedocOnClick($sender) {
$logger->error($ee->getMessage() . " Документ " . $this->_doc->meta_desc);
return;
}
App::RedirectBack();
App::Redirect("\\App\\Pages\\Register\\StockList");

}

/**
Expand Down
8 changes: 3 additions & 5 deletions www/app/pages/doc/retcustissue.php
Original file line number Diff line number Diff line change
Expand Up @@ -278,11 +278,9 @@ public function savedocOnClick($sender) {
}

$conn->CommitTrans();
if ($isEdited) {
App::RedirectBack();
} else {
App::Redirect("\\App\\Pages\\Register\\GIList");
}

App::Redirect("\\App\\Pages\\Register\\GIList");

} catch(\Throwable $ee) {
global $logger;
$conn->RollbackTrans();
Expand Down
3 changes: 2 additions & 1 deletion www/app/pages/doc/returnissue.php
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,8 @@ public function savedocOnClick($sender) {


$conn->CommitTrans();
App::RedirectBack();
App::Redirect("\\App\\Pages\\Register\\GIList");

} catch(\Throwable $ee) {
global $logger;
$conn->RollbackTrans();
Expand Down
3 changes: 2 additions & 1 deletion www/app/pages/doc/serviceact.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,8 @@ public function savedocOnClick($sender) {
}

$conn->CommitTrans();
App::RedirectBack();
App::Redirect("\\App\\Pages\\Register\\SerList");

} catch(\Throwable $ee) {
global $logger;
$conn->RollbackTrans();
Expand Down
6 changes: 2 additions & 4 deletions www/app/pages/doc/task.php
Original file line number Diff line number Diff line change
Expand Up @@ -474,11 +474,9 @@ public function savedocOnClick($sender) {
}

$conn->CommitTrans();
if ($this->_doc->state < 4) {
App::RedirectBack();
} else {

App::Redirect("\\App\\Pages\\Register\\TaskList");
}

} catch(\Throwable $ee) {
global $logger;
$conn->RollbackTrans();
Expand Down
3 changes: 2 additions & 1 deletion www/app/pages/doc/transitem.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ public function savedocOnClick($sender) {
$this->_doc->updateStatus($isEdited ? Document::STATE_EDITED : Document::STATE_NEW);
}
$conn->CommitTrans();
App::RedirectBack();
App::Redirect("\\App\\Pages\\Register\\StockList");

} catch(\Throwable $ee) {
global $logger;
$conn->RollbackTrans();
Expand Down
3 changes: 2 additions & 1 deletion www/app/pages/doc/warranty.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,8 @@ public function savedocOnClick($sender) {
}

$conn->CommitTrans();
App::RedirectBack();
App::Redirect("\\App\\Pages\\Register\\GIList");

} catch(\Throwable $ee) {
global $logger;
$conn->RollbackTrans();
Expand Down
15 changes: 14 additions & 1 deletion www/app/pages/register/deliverylist.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,5 +191,18 @@ public function updateorderlist($sender) {


}


public function getMessages($args,$post){

$cnt = 0;
$mlist = \App\Entity\Notify::find("checked <> 1 and user_id=".\App\Entity\Notify::DELIV) ;
foreach($mlist as $n) {
$doc = Document::load(intval($n->message)) ;
if($doc->state==Document::STATE_READYTOSHIP) $cnt++;
}

\App\Entity\Notify::markRead(\App\Entity\Notify::DELIV);

return json_encode(array("cnt"=>$cnt), JSON_UNESCAPED_UNICODE);
}
}
39 changes: 37 additions & 2 deletions www/app/pages/service/armfood.php
Original file line number Diff line number Diff line change
Expand Up @@ -668,11 +668,23 @@ public function todelOnClick($sender) {
return;
}


$n = new \App\Entity\Notify();
$n->user_id = \App\Entity\Notify::DELIV;
$n->dateshow = time();
$n->message = $this->_doc->document_id;

$n->save();
$this->setInfo('sentdelivary');

} else { //в производство
$this->_doc->updateStatus(Document::STATE_INPROCESS);
$n = new \App\Entity\Notify();
$n->user_id = \App\Entity\Notify::ARMFOODPROD;
$n->dateshow = time();
$n->message = $this->_doc->document_id;

$n->save();

$this->setInfo('sentprod');

}
Expand Down Expand Up @@ -703,7 +715,13 @@ public function toprodOnClick($sender) {
$logger->error($ee->getMessage() . " Документ " . $this->_doc->meta_desc);
return;
}


$n = new \App\Entity\Notify();
$n->user_id = \App\Entity\Notify::ARMFOODPROD;
$n->dateshow = time();
$n->message = $this->_doc->document_id;

$n->save();


$this->setInfo('sentprod');
Expand Down Expand Up @@ -951,5 +969,22 @@ public function OnChangeCustomer($sender) {


}


public function getMessages($args,$post){

$cntorder = 0;
$cntprod = 0;
$mlist = \App\Entity\Notify::find("checked <> 1 and user_id=".\App\Entity\Notify::ARMFOOD) ;
foreach($mlist as $n) {
$doc = Document::load(intval($n->message)) ;
if($doc->state == Document::STATE_FINISHED) $cntprod++;
if($doc->state == Document::STATE_NEW) $cntorder++;
}

\App\Entity\Notify::markRead(\App\Entity\Notify::ARMFOOD);

return json_encode(array("cntprod"=>$cntprod, 'cntorder'=>$cntorder), JSON_UNESCAPED_UNICODE);
}

}
32 changes: 27 additions & 5 deletions www/app/pages/service/armprodfood.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,40 @@ public function onReady($sender){
if($it->foodstate!==1) $hasinproces=true;
}
if($hasinproces == false) {
$doc->updateStatus(Document::STATE_FINISHED) ;
if($doc->payed>0) {
$doc->updateStatus(Document::STATE_CLOSED) ;
}
$doc->updateStatus(Document::STATE_FINISHED) ;

if($doc->headerdata['delivery'] >0) {
$doc->updateStatus(Document::STATE_READYTOSHIP) ;

$n = new \App\Entity\Notify();
$n->user_id = \App\Entity\Notify::DELIV;
$n->dateshow = time();
$n->message = $doc->document_id;

$n->save();
} else
{
if($doc->payed>0) {
$doc->updateStatus(Document::STATE_CLOSED) ;
}
}

}
$this->update(null) ;
}

public function getMessages($args,$post){
return json_encode(array(1,2,3), JSON_UNESCAPED_UNICODE);

$cnt = 0;
$mlist = \App\Entity\Notify::find("checked <> 1 and user_id=".\App\Entity\Notify::ARMFOODPROD) ;
foreach($mlist as $n) {
$doc = Document::load(intval($n->message)) ;
if($doc->state == Document::STATE_INPROCESS) $cnt++;
}

\App\Entity\Notify::markRead(\App\Entity\Notify::ARMFOODPROD);

return json_encode(array("cnt"=>$cnt), JSON_UNESCAPED_UNICODE);
}


Expand Down
8 changes: 8 additions & 0 deletions www/assets/js/mustache.js
Original file line number Diff line number Diff line change
Expand Up @@ -777,3 +777,11 @@ const mustache = require('mustache');

window.require = require;
},{"mustache":1}]},{},[2]);



// var Mustache = require('mustache');
// var dd= chattpl.content.querySelectorAll("div");
// var output = Mustache.render('<[{xxx}]>' , {"xxx":"d<br>d"},{},[ '<[', ']>' ]);
// console.log(output );

2 changes: 1 addition & 1 deletion www/config/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ shop=1 ; встроеный модуль онлайн каталога
note=1 ; модуль органайзера(базы знаний)
issue=1 ; модуль Проекты и задачи
woocomerce=0 ; интеграция с вукомерсе
tecdoc=1 ; поиск по базе автозапчастей
tecdoc=0 ; поиск по базе автозапчастей
ppo=0 ; фискализация
np=0 ; Новая Почта

2 changes: 1 addition & 1 deletion www/templates/pages/doc/prodissue.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ <h3>Списание на производство </h3>
<div class="form-group ">
<label for="notes">Примечание </label>

<input class="form-control" type="text" zippy="notes">
<textarea class="form-control" zippy="notes"></textarea>


</div>
Expand Down
3 changes: 2 additions & 1 deletion www/templates/pages/doc/prodreceipt.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ <h3> Оприходование с производства </h3>
<div class="form-group ">
<label for="notes">Примечание </label>

<input class="form-control" type="text" zippy="notes">
<textarea class="form-control" zippy="notes"></textarea>


</div>

Expand Down
Loading

0 comments on commit 78c44ba

Please sign in to comment.