This repository has been archived by the owner on Jul 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Naskladnění.php
80 lines (63 loc) · 2.25 KB
/
Naskladnění.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/usr/bin/php -f
<?php
/**
* FlexiPeeHP - Naskaladnění včetně sériových čísel
*
* @author Vítězslav Dvořák <[email protected]>
* @copyright (G) 2018 Vitex Software
*/
namespace Example\FlexiPeeHP;
include_once './config.php';
include_once '../vendor/autoload.php';
$storage = 'SKLAD';
$productCode = \Ease\Sand::randomString();
$serialNumbers = [
\Ease\Sand::randomString(),
\Ease\Sand::randomString(),
\Ease\Sand::randomString(),
\Ease\Sand::randomString()
];
$defaultSerialNumber = \Ease\Sand::randomString();
/** Preparation * */
//We need an exising item
$product = new \FlexiPeeHP\Cenik();
$product->insertToFlexiBee([
'kod' => $productCode,
'nazev' => $productCode,
'typZasobyK' => 'typZasoby.zbozi',
'evidVyrCis' => true,
// 'unikVyrCis'=> fase,
'skladove' => true
]);
//with storage card for at least current accounting period
$storageCard = new \FlexiPeeHP\SkladovaKarta();
$storageCard->insertToFlexiBee([
'sklad' => \FlexiPeeHP\FlexiBeeRO::code($storage),
'cenik' => \FlexiPeeHP\FlexiBeeRO::code($productCode),
'ucetObdobi' => \FlexiPeeHP\FlexiBeeRO::code(date('Y'))
]);
/** Preparation End * */
$skladovyPohyb = new \FlexiPeeHP\SkladovyPohyb([
'id' => 'ext:PRIJEMKA:'.time(),
'typDokl' => \FlexiPeeHP\FlexiBeeRO::code('STANDARD'),
'sklad' => \FlexiPeeHP\FlexiBeeRO::code($storage),
'cenik' => \FlexiPeeHP\FlexiBeeRO::code($productCode),
'typPohybuK' => 'typPohybu.prijem',
],['debug'=>true]);
// We Need
$productModel = new \FlexiPeeHP\SkladovyPohybPolozka([
'sklad' => \FlexiPeeHP\FlexiBeeRO::code($storage),
'cenik' => \FlexiPeeHP\FlexiBeeRO::code($productCode)
], ['offline' => true]);
//Add Serial numbers one by one
foreach ($serialNumbers as $serialNumber) {
$productModel->addSerialNumber($serialNumber);
}
//Also add default serial number
$productModel->addSerialNumber($defaultSerialNumber, true); //Add another number - the Main one
//$skladovyPohyb->addArrayToBranch([$productModel->getEvidence() => $productModel->getData()]);
$skladovyPohyb->addObjectToBranch($productModel);
//And Now We can save it into FlexiBee
$skladovyPohyb->insertToFlexiBee();
echo $skladovyPohyb->postFields;
echo $skladovyPohyb->lastCurlResponse;