Skip to content

Commit

Permalink
Merge pull request #671 from leon-mbs/dev
Browse files Browse the repository at this point in the history
6.8.11
  • Loading branch information
leon-mbs authored Jan 1, 2024
2 parents da77b9b + 142e93c commit 4773a9e
Show file tree
Hide file tree
Showing 39 changed files with 18,964 additions and 629 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Zippy-склад
* закупівля
* продаж
* облік платежів та взаєморозрахунки з контрагентами
* попартійний облік та облік за серіями виробника
* управління користувачами та розділенням доступу, особистий кабінет користувача
* робота з лідами та інші елементи CRM
* звіти з продажу, закупівлі, руху товару
Expand All @@ -27,10 +26,9 @@ Zippy-склад
* підтримка сканера (клавіатурного) штрих-коду
* підтримка принтерів чеків та етикеток
* розділення доступу між філіями (наприклад торговими точками)
* модуль інтеграції з Опенкарт
* модуль інтеграції з Woocomerce
* інтеграція з Опенкар,Woocomerce,PromUa, Хорошоп
* інтеграція з Новою Поштою
* інтеграція з CheckBox
* інтеграція з CheckBox та ВчасноКаса
* вбудований програмний РРО
* інтеграція з сервісами СМС розсилок
* API для доступу із зовнішніх систем, наприклад з 1С.
Expand Down
6 changes: 1 addition & 5 deletions www/app/entity/doc/document.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,7 @@ private function packData() {
$value= str_replace('<![CDATA[', '', $value) ;
$value= str_replace(']]>', '', $value) ;

if (strpos($value, '[CDATA[') !== false) {
// \App\System::setWarnMsg('CDATA в поле обьекта');
// \App\Helper::log(' CDATA в поле обьекта');
continue;
}
$value = $value ?? '';

if (is_numeric($value) || strlen($value) == 0) {

Expand Down
58 changes: 53 additions & 5 deletions www/app/entity/doc/order.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

use App\Helper as H;
use App\System;
use App\Entity\Item;
use App\Entity\Entry;

/**
* Класс-сущность документ расходная накладая
Expand Down Expand Up @@ -90,15 +92,14 @@ protected function getNumberTemplate() {
public function getRelationBased() {
$list = array();
$list['GoodsIssue'] = self::getDesc('GoodsIssue');
$list['ProdReceipt'] = self::getDesc('ProdReceipt');
if($this->payed==0) {
$list['Invoice'] = self::getDesc('Invoice');
}
$list['POSCheck'] = self::getDesc('POSCheck');
$list['Task'] = self::getDesc('Task');
$list['TTN'] = self::getDesc('TTN');
$list['Order'] = self::getDesc('Order');
$list['OrderCust'] = self::getDesc('OrderCust');


return $list;
}
Expand Down Expand Up @@ -163,13 +164,60 @@ public function reserve() {
$items = $this->unpackDetails('detaildata') ;

foreach ($items as $item) {
$onstore = H::fqty($item->getQuantity($this->headerdata['store'])) ;
$required = $item->quantity - $onstore;

//оприходуем с производства
if ($required >0 && $item->autoincome == 1 && ($item->item_type == Item::TYPE_PROD || $item->item_type == Item::TYPE_HALFPROD)) {

if ($item->autooutcome == 1) { //комплекты
$set = \App\Entity\ItemSet::find("pitem_id=" . $item->item_id);
foreach ($set as $part) {

$itemp = \App\Entity\Item::load($part->item_id);
if($itemp == null) {
continue;
}
$itemp->quantity = $required * $part->qty;

if (false == $itemp->checkMinus($itemp->quantity, $this->headerdata['store'])) {
throw new \Exception("На складі всього ".H::fqty($itemp->getQuantity($this->headerdata['store']))." ТМЦ {$itemp->itemname}. Списання у мінус заборонено");
}

$listst = \App\Entity\Stock::pickup($this->headerdata['store'], $itemp);

foreach ($listst as $st) {
$sc = new Entry($this->document_id, 0 - $st->quantity * $st->partion, 0 - $st->quantity);
$sc->setStock($st->stock_id);
$sc->tag=Entry::TAG_TOPROD;

$sc->save();
}
}
}


$price = $item->getProdprice();

if ($price == 0) {
throw new \Exception('Не розраховано собівартість готової продукції '. $item->itemname);
}
$stock = \App\Entity\Stock::getStock($this->headerdata['store'], $item->item_id, $price, $item->snumber, $item->sdate, true);

$sc = new Entry($this->document_id, $required * $price, $required);
$sc->setStock($stock->stock_id);
$sc->tag=Entry::TAG_FROMPROD;

$sc->save();
}



if (false == $item->checkMinus($item->quantity, $this->headerdata['store'])) {
throw new \Exception("На складі всього ".H::fqty($item->getQuantity($this->headerdata['store']))." ТМЦ {$item->itemname}. Списання у мінус заборонено");

}

}
foreach ($items as $item) {


$listst = \App\Entity\Stock::pickup($this->headerdata['store'], $item);

Expand Down
85 changes: 85 additions & 0 deletions www/app/modules/hr/helper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?php

namespace App\Modules\HR;

use App\System;
use App\Helper as H;

/**
* Вспомагательный класс
*/
class Helper
{
public static function connect() {

$modules = System::getOptions("modules");

$body = [];
$body['login'] = $modules['hrlogin'];
$body['password'] = $modules['hrpassword'];

try {
$ret = self::make_request("POST", "/api/auth", json_encode($body));
} catch(\Exception $ee) {
System::setErrorMsg($ee->getMessage());
return;
}

if(!is_array($ret)) {
//System::setSuccessMsg("Успішне з`єднання");
return;
}

if(($ret['token'] ??'')=='') {
System::setErrorMsg('Invalid token');
return;
}

return $ret['token'] ??'';

}

public static function make_request($method, $url, $body='') {

$modules = System::getOptions("modules");
$usessl = $modules['hrssl'];


$headers = array(
'Content-Type: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $modules['hrsite'] . $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

if (strtoupper($method) == 'POST') {
curl_setopt($ch, CURLOPT_POST, true);
}

if (strlen($body)>0) {
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
}

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $usessl == 1);
// \App\Helper::log(json_encode($body, JSON_UNESCAPED_UNICODE)) ;
$result = curl_exec($ch);
if (curl_errno($ch) > 0) {
throw new \Exception(curl_error($ch));
}
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if($httpcode >=300) {
throw new \Exception("http code ".$httpcode);
}
curl_close($ch);

$ret = json_decode($result, true) ;
if (strlen($ret['status']=='ERROR') ) {
throw new \Exception($ret['response']['message']);
}

return $ret['response'];
}

}
Loading

0 comments on commit 4773a9e

Please sign in to comment.