Skip to content

Commit

Permalink
v.5.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
leon-mbs committed Jun 6, 2021
1 parent 85ddcd8 commit 576cd30
Show file tree
Hide file tree
Showing 37 changed files with 2,519 additions and 1,631 deletions.
2,770 changes: 1,385 additions & 1,385 deletions db/db.sql

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions db/initdata.sql
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `men
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(88, 1, 'Перемещение денег', 'MoveMoney', 'Касса и платежи', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(89, 1, 'Заказ (общепит)', 'OrderFood', '', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(91, 5, 'АРМ кассира', 'ARMFood', 'Общепит', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(95, 3, 'Журнал доставок', 'DeliveryList', 'Общепит', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(96, 5, 'АРМ кухни (бара)', 'ArmProdFood', 'Общепит', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(97, 3, 'Доходы и расходы', 'IOState', '', 0);



Expand Down
3 changes: 3 additions & 0 deletions db/initdata_ua.sql
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,7 @@ INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `men
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(88, 1, 'Перемiщення грошей', 'MoveMoney', 'Каса та платежі', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(89, 1, 'Замовленя кафе', 'OrderFood', 'Кафе', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(91, 5, 'АРМ касира (кафе)', 'ARMFood', 'Кафе', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(95, 3, 'Журнал доставок', 'DeliveryList', 'Кафе', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(96, 5, 'АРМ кухнi (бару)', 'ArmProdFood', 'Кафе', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(97, 3, 'Прибутки та видатки', 'IOState', '', 0);

3 changes: 3 additions & 0 deletions db/update510to520.sql
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,7 @@ ALTER VIEW `paylist_view` AS
from
(((`paylist` `pl` join `documents_view` `d` on((`pl`.`document_id` = `d`.`document_id`))) join `users_view` `u` on((`pl`.`user_id` = `u`.`user_id`))) left join `mfund` `m` on((`pl`.`mf_id` = `m`.`mf_id`)));

INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 3, 'Журнал доставок', 'DeliveryList', 'Общепит', 0);
INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 5, 'АРМ кухни (бара)', 'ArmProdFood', 'Общепит', 0);
INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 3, 'Доходы и расходы', 'IOState', '', 0);

6 changes: 3 additions & 3 deletions www/app/entity/doc/document.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ public static function create($classname, $branch_id = 0) {
* Приведение типа и клонирование документа
*/
public function cast() {

if (strlen($this->meta_name) == 0) {
$metarow = Helper::getMetaType($this->meta_id);
$this->meta_name = $metarow['meta_name'];
Expand Down Expand Up @@ -346,10 +346,10 @@ public function updateStatus($state) {

$state = self::STATE_WA; //переводим на ожидание утверждения
}

else
if ($state == self::STATE_CANCELED) {
$this->Cancel();
}
} else
if ($state == self::STATE_EXECUTED) {
$this->Execute();
}
Expand Down
29 changes: 19 additions & 10 deletions www/app/entity/doc/orderfood.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,19 @@ public function generateReport() {
$common = \App\System::getOptions('common');

$firm = H::getFirmData($this->firm_id);

$deliverydata="";
$deliverydata = $this->headerdata["delivery_name"] ;
if($this->headerdata["delivery"] >1) $deliverydata = $deliverydata .', '.$this->headerdata["ship_address"];
$deliverydata = $deliverydata .', '.date("Y-m-d H:i",$this->headerdata["deltime"] );

$header = array('date' => H::fd($this->document_date),
"_detail" => $detail,
"firm_name" => $firm["firm_name"],
"shopname" => $common["shopname"],
"address" => $firm["address"],
"phone" => $firm["phone"],
"inn" => $firm["inn"],
"isdelivery" => $this->headerdata["delivery"] > 0,
"deliverydata" => $deliverydata ,


"customer_name" => strlen($this->customer_name) > 0 ? $this->customer_name : false,
"exchange" => H::fa($this->headerdata["exchange"]),
"pos_name" => $this->headerdata["pos_name"],
Expand All @@ -59,7 +64,6 @@ public function generateReport() {
"payed" => H::fa($this->payed),
"paydisc" => H::fa($this->headerdata["paydisc"]),
"isdisc" => $this->headerdata["paydisc"] > 0,
"prepaid" => $this->headerdata['payment'] == \App\Entity\MoneyFund::PREPAID,
"payamount" => H::fa($this->payamount)
);

Expand Down Expand Up @@ -109,7 +113,7 @@ public function generatePosReport() {
"payed" => H::fa($this->payed),
"paydisc" => H::fa($this->headerdata["paydisc"]),
"isdisc" => $this->headerdata["paydisc"] > 0,
"prepaid" => $this->headerdata['payment'] == \App\Entity\MoneyFund::PREPAID,

"payamount" => H::fa($this->payamount)
);

Expand All @@ -122,9 +126,7 @@ public function generatePosReport() {

public function Execute() {

$this->DoStore() ;

$this->DoPayment() ;


return true;
}
Expand All @@ -140,7 +142,14 @@ public function supportedExport() {

public function DoPayment() {
if ($this->headerdata['payment'] > 0 && $this->payed > 0) {
$payed = \App\Entity\Pay::addPayment($this->document_id, $this->document_date, $this->payed, $this->headerdata['payment'], \App\Entity\IOState::TYPE_BASE_INCOME);
$payed = $this->payed;
if ($this->headerdata['exchange'] > 0 && $this->payed > $this->headerdata['exchange']) {

$payed = $this->payed - $this->headerdata['exchange']; //без здачи
}


$payed = \App\Entity\Pay::addPayment($this->document_id, $this->document_date, $payed, $this->headerdata['payment'], \App\Entity\IOState::TYPE_BASE_INCOME);
if ($payed > 0) {
$this->payed = $payed;
}
Expand Down
30 changes: 22 additions & 8 deletions www/app/modules/shop/pages/order.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function OnSave($sender) {
}
$shop = System::getOptions("shop");

$time = trim($this->orderform->time->getText());
$time = trim($this->orderform->time->getDate());
$email = trim($this->orderform->email->getText());
$phone = trim($this->orderform->phone->getText());
$name = trim($this->orderform->name->getText());
Expand All @@ -118,17 +118,29 @@ public function OnSave($sender) {
$this->setError("enterteldeliv");
return;
}
if (strlen($phone) == 0 && strlen($email) == 0) {

$this->setError("entertelemail");
return;

if($this->_tvars["isfood"] == true) {

if (strlen($phone) == 0 ) {

$this->setError("entertelemail");
return;
}
}
else {
if (strlen($phone) == 0 && strlen($email) == 0) {

$this->setError("entertelemail");
return;
}
}
if (strlen($phone) > 0 && strlen($phone) != \App\Helper::PhoneL()) {
$this->setError("tel10", \App\Helper::PhoneL());
return;
}

if($this->_tvars["isfood"] && $time < (time()+3600) ) {
if($this->_tvars["isfood"] && $time < (time()+1800) ) {
$this->setError("timedelivery" );
return;
}
Expand Down Expand Up @@ -174,9 +186,10 @@ public function OnSave($sender) {
'delivery' => $delivery,
'delivery_name' => $this->orderform->delivery->getValueName(),
'email' => $email,
'time' => $time,
'deltime' => $time,
'phone' => $phone,
'ship_address' => $address,
'ship_name' => $name,
'total' => $amount
);
$order->packDetails('detaildata', $itlist);
Expand Down Expand Up @@ -206,15 +219,16 @@ public function OnSave($sender) {
$order->customer_id = $c->customer_id;
}
}

$order->headerdata['pricetype'] = $shop["defpricetype"];
$order->headerdata['contact'] = $name.', '.$phone;

$order->notes = trim($this->orderform->notes->getText());
$order->amount = $amount;
$order->payamount = $amount;
$order->branch_id = $op["defbranch"];
$order->save();
$order->updateStatus(Document::STATE_NEW);
if ($shop['ordertype'] == 1) {
if ($shop['ordertype'] == 1) { //Кассовый чек
$order->updateStatus(Document::STATE_EXECUTED);
}

Expand Down
2 changes: 1 addition & 1 deletion www/app/pages/doc/incomeitem.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ public function addcodeOnClick($sender) {
return;
}

if ($this->_tvars["usesnumber"] == true) {
if ($this->_tvars["usesnumber"] == true && $item->useserial==1 ) {

$this->editdetail->setVisible(true);
$this->docform->setVisible(false);
Expand Down
2 changes: 1 addition & 1 deletion www/app/pages/doc/inventory.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ public function addcodeOnClick($sender) {
return;
}

if ($this->_tvars["usesnumber"] == true) {
if ($this->_tvars["usesnumber"] == true && $item->useserial==1 ) {

$this->editdetail->setVisible(true);
$this->docform->setVisible(false);
Expand Down
2 changes: 1 addition & 1 deletion www/app/pages/doc/moveitem.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ public function addcodeOnClick($sender) {
return;
}

if ($this->_tvars["usesnumber"] == true) {
if ($this->_tvars["usesnumber"] == true && $item->useserial==1 ) {

$this->editdetail->setVisible(true);
$this->docform->setVisible(false);
Expand Down
2 changes: 1 addition & 1 deletion www/app/pages/doc/outcomeitem.php
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ public function addcodeOnClick($sender) {
return;
}

if ($this->_tvars["usesnumber"] == true) {
if ($this->_tvars["usesnumber"] == true && $item->useserial==1 ) {

$this->editdetail->setVisible(true);
$this->docform->setVisible(false);
Expand Down
2 changes: 1 addition & 1 deletion www/app/pages/doc/prodreceipt.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public function saverowOnClick($sender) {
if ($item->sdate == false) {
$item->sdate = '';
}
if (strlen($item->snumber) > 0 && strlen($item->sdate) == 0 && $this->_tvars["usesnumber"] == true) {
if (strlen($item->snumber) > 0 && strlen($item->sdate) == 0 && $this->_tvars["usesnumber"] == true && $item->useserial==1 ) {
$this->setError("dateforserial");
return;
}
Expand Down
5 changes: 5 additions & 0 deletions www/app/pages/options.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ public function __construct() {
//печать
$this->add(new Form('printer'))->onSubmit($this, 'savePrinterOnClick');
$this->printer->add(new TextInput('pwidth'));
$this->printer->add(new TextInput('pmaxname'));
$this->printer->add(new DropDownChoice('pricetype', \App\Entity\Item::getPriceTypeList()));
$this->printer->add(new DropDownChoice('barcodetype', array('EAN13' => 'EAN-13', 'EAN8' => 'EAN-8', 'C128' => 'Code128', 'C39' => 'Code39'), 'Code128'));
$this->printer->add(new DropDownChoice('pfontsize', array('12' => '12', '14' => '14', '16' => '16', '20' => '20', '24' => '24', '28' => '28', '36' => '36',), '16'));
Expand All @@ -156,6 +157,7 @@ public function __construct() {
}

$this->printer->pwidth->setText($printer['pwidth']);
$this->printer->pmaxname->setText($printer['pmaxname']);
$this->printer->pricetype->setValue($printer['pricetype']);
$this->printer->barcodetype->setValue($printer['barcodetype']);
$this->printer->pfontsize->setValue($printer['pfontsize']);
Expand Down Expand Up @@ -217,6 +219,7 @@ public function __construct() {
}
$this->add(new Form('food'))->onSubmit($this,'onFood');
$this->food->add(new DropDownChoice('foodpricetype', \App\Entity\Item::getPriceTypeList(),$food['pricetype']));
$this->food->add(new DropDownChoice('foodworktype', array(),$food['worktype']));
$this->food->add(new CheckBox('fooddelivery',$food['delivery']));
$this->food->add(new CheckBox('foodtables',$food['tables']));
$this->food->add(new CheckBox('foodpack',$food['pack']));
Expand Down Expand Up @@ -305,6 +308,7 @@ public function saveValOnClick($sender) {
public function savePrinterOnClick($sender) {
$printer = array();
$printer['pwidth'] = $this->printer->pwidth->getText();
$printer['pmaxname'] = $this->printer->pmaxname->getText();
$printer['pricetype'] = $this->printer->pricetype->getValue();
$printer['barcodetype'] = $this->printer->barcodetype->getValue();
$printer['pfontsize'] = $this->printer->pfontsize->getValue();
Expand Down Expand Up @@ -377,6 +381,7 @@ public function testSMSOnClick($sender) {
}
public function onFood($sender) {
$food = array();
$food['worktype'] = $sender->foodworktype->getValue() ;
$food['pricetype'] = $sender->foodpricetype->getValue() ;
$food['delivery'] = $sender->fooddelivery->isChecked()?1:0 ;
$food['tables'] = $sender->foodtables->isChecked()?1:0 ;
Expand Down
29 changes: 27 additions & 2 deletions www/app/pages/reference/itemlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class ItemList extends \App\Pages\Base
{

private $_item;
private $_copy = false;
private $_pitem_id = 0;
public $_itemset = array();

Expand Down Expand Up @@ -183,6 +184,7 @@ public function itemlistOnRow(\Zippy\Html\DataList\DataRow $row) {
$row->add(new Label('cell', $item->cell));
$row->add(new Label('inseria'))->setVisible($item->useserial);

$row->add(new ClickLink('copy'))->onClick($this, 'copyOnClick');
$row->add(new ClickLink('edit'))->onClick($this, 'editOnClick');

$row->add(new ClickLink('set'))->onClick($this, 'setOnClick');
Expand All @@ -204,7 +206,14 @@ public function itemlistOnRow(\Zippy\Html\DataList\DataRow $row) {



public function copyOnClick($sender) {
$this->editOnClick($sender);
$this->_copy = true;
$this->_item->item_id=0;

}
public function editOnClick($sender) {
$this->_copy = false;
$item = $sender->owner->getDataItem();
$this->_item = Item::load($item->item_id);

Expand Down Expand Up @@ -259,6 +268,7 @@ public function editOnClick($sender) {
}

public function addOnClick($sender) {
$this->_copy = false;
$this->itemtable->setVisible(false);
$this->itemdetail->setVisible(true);
// Очищаем форму
Expand Down Expand Up @@ -291,7 +301,7 @@ public function OnSubmit($sender) {
if (false == \App\ACL::checkEditRef('ItemList')) {
return;
}

$this->_item->itemname = $this->itemdetail->editname->getText();
if (strlen($this->_item->itemname) == 0) {
$this->setError('entername');
Expand Down Expand Up @@ -362,6 +372,13 @@ public function OnSubmit($sender) {
$this->setWarn('barcode_exists');
}
}
$printer = System::getOptions('printer');

if ( intval($printer['pmaxname']) >0 && strlen($this->_item->shortname) > intval($printer['pmaxname']) ) {

$this->setWarn('tolongshortname',$printer['pmaxname']);

}


$itemname = Item::qstr($this->_item->itemname);
Expand All @@ -380,7 +397,15 @@ public function OnSubmit($sender) {
$this->_item->image_id = 0;
}

$this->_item->Save();
if ($this->_item->image_id > 0 && $this->_copy==true) {
$image = \App\Entity\Image::load($this->_item->image_id);
$image->image_id = 0;
$image->save();
$this->_item->image_id = $image->image_id;

}

$this->_item->save();

$file = $this->itemdetail->editaddfile->getFile();
if (strlen($file["tmp_name"]) > 0) {
Expand Down
34 changes: 34 additions & 0 deletions www/app/pages/register/deliverylist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace App\Pages\Register;

use App\Application as App;
use App\Entity\Doc\Document;
use App\Helper as H;
use App\System;
use Zippy\Html\DataList\DataView;
use Zippy\Html\DataList\Paginator;
use Zippy\Html\Form\Date;
use Zippy\Html\Form\DropDownChoice;
use Zippy\Html\Form\Form;
use Zippy\Html\Form\SubmitButton;
use Zippy\Html\Form\TextInput;
use Zippy\Html\Label;
use Zippy\Html\Link\ClickLink;
use Zippy\Html\Panel;

/**
* журнал доставок
*/
class DeliveryList extends \App\Pages\Base
{

private $_doc = null;

public function __construct() {
parent::__construct();
if (false == \App\ACL::checkShowReg('DeliveryList')) {
return;
}
}
}
Loading

0 comments on commit 576cd30

Please sign in to comment.