Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 398
0.00% covered (danger)
0.00%
0 / 22
CRAP
0.00% covered (danger)
0.00%
0 / 1
TransferReceiptToWarehouse_test
0.00% covered (danger)
0.00%
0 / 398
0.00% covered (danger)
0.00%
0 / 22
870
0.00% covered (danger)
0.00%
0 / 1
 __construct
n/a
0 / 0
n/a
0 / 0
1
 test_TRW01_เข้าหน้าแรกต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 1
2
 test_TRW02_เข้าหน้าหลักต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 1
2
 test_TRW03_โหลดข้อมูลรายการเอกสาร_ต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 21
0.00% covered (danger)
0.00%
0 / 1
2
 test_TRW04_เข้าหน้าจอเพิ่มเอกสาร_ต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 1
2
 test_TRW05_โหลดข้อมูลรายการสินค้าแสดงเป็นตาราง_ต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 16
0.00% covered (danger)
0.00%
0 / 1
2
 test_TRW06_เพิ่มสินค้าลงตารางแบบบวกเพิ่มแถวใหม่_1_รายการต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 15
0.00% covered (danger)
0.00%
0 / 1
2
 test_TRW07_เพิ่มสินค้าลงตารางแบบบวกเพิ่มแถวใหม่__สินค้าตัวเดิม_ต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 15
0.00% covered (danger)
0.00%
0 / 1
2
 test_TRW08_แก้ไขตัวเลือกกรณีเพิ่มสินค้ารายการเดิม_ต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 1
2
 test_TRW09_เพิ่มสินค้าลงตารางแบบบวกจำนวนในรายการเดิม_1_รายการต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 15
0.00% covered (danger)
0.00%
0 / 1
2
 test_TRW10_เพิ่มสินค้าลงตารางแบบบวกจำนวนในรายการเดิม_สินค้าตัวเดิม_ต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 15
0.00% covered (danger)
0.00%
0 / 1
2
 test_TRW11_เพิ่มสินค้าลงตารางแบบบวกจำนวนในรายการเดิม_2_รายการต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 16
0.00% covered (danger)
0.00%
0 / 1
2
 test_TRW12_ลบสินค้าในตาราง_1_รายการต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 15
0.00% covered (danger)
0.00%
0 / 1
2
 test_TRW13_ลบสินค้าในตารางหลายรายการ_ต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 25
0.00% covered (danger)
0.00%
0 / 1
2
 test_TRW14_เพิ่มสินค้าลงตารางแบบบวกจำนวนในรายการเดิม_3_รายการต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 16
0.00% covered (danger)
0.00%
0 / 1
2
 test_TRW15_แก้ไขจำนวนของสินค้ารายการที่_1_ต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 16
0.00% covered (danger)
0.00%
0 / 1
2
 test_TRW16_แก้ไขราคาต่อหน่วยของสินค้ารายการที่_2_ต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 16
0.00% covered (danger)
0.00%
0 / 1
2
 test_TRW17_บันทึกเอกสาร_ต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 81
0.00% covered (danger)
0.00%
0 / 1
2
 test_TRW18_เข้าหน้าจอแก้ไขเอกสาร_ต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 18
0.00% covered (danger)
0.00%
0 / 1
6
 test_TRW19_อนุมัติเอกสาร_ต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 19
0.00% covered (danger)
0.00%
0 / 1
6
 test_TRW20_ยกเลิกเอกสาร_ต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 17
0.00% covered (danger)
0.00%
0 / 1
6
 test_TRW21_ลบเอกสาร_1_เอกสารต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 17
0.00% covered (danger)
0.00%
0 / 1
6
 test_TRW22_ลบเอกสาร_2_เอกสารต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 16
0.00% covered (danger)
0.00%
0 / 1
12
1<?php
2/**
3 * Part of ci-phpunit-test
4 *
5 * @author     Kenji Suzuki <https://github.com/kenjis>
6 * @license    MIT License
7 * @copyright  2015 Kenji Suzuki
8 * @link       https://github.com/kenjis/ci-phpunit-test
9 */
10
11 class TransferReceiptToWarehouse_test extends TestCase
12{
13    /**
14     * @codeCoverageIgnore
15     */
16    public function __construct() {
17        parent::__construct();
18        $ci = &get_instance();
19        $ci->load->database();
20        $ci->load->helper('validator_helper');
21        $this->code = substr(md5(uniqid(mt_rand(), true)), 0, 5);
22        $_SESSION =array (
23            '__ci_last_regenerate' => 1674475513,
24            'lang' => 'th',
25            'tLangID' => 1,
26            'tSesUserLogin' => '009',
27            'tSesUsrRoleCodeMulti' => '\'00002\'',
28            'nSesUsrRoleLevel' => 99,
29            'tSesUsrAgnCode' => NULL,
30            'tSesUsrAgnName' => NULL,
31            'tSesUsrMerCode' => NULL,
32            'tSesUsrMeclsrName' => NULL,
33            'tSesUsrBchCodeDefault' => '00001',
34            'tSesUsrBchNameDefault' => 'AdaSoft00001',
35            'tSesUsrBchCodeMulti' => '\'00001\'',
36            'tSesUsrBchNameMulti' => '\'AdaSoft00001\'',
37            'nSesUsrBchCount' => 0,
38            'tSesUsrShpCodeDefault' => '00014',
39            'tSesUsrShpNameDefault' => 'รันไทม์ช็อป',
40            'tSesUsrShpCodeMulti' => '\'00014\'',
41            'tSesUsrShpNameMulti' => '\'รันไทม์ช็อป\'',
42            'nSesUsrShpCount' => 0,
43            'tSesUsrWahCode' => '00001',
44            'tSesUsrWahName' => 'คลังขาย',
45            'tSesUsrLoginLevel' => 'HQ',
46            'tSesUsrLoginAgency' => 0,
47            'bSesLogIn' => 1,
48            'tSesUserCode' => '00002',
49            'tSesUsername' => '00002',
50            'tSesUsrDptName' => NULL,
51            'tSesUsrDptCode' => NULL,
52            'tSesUsrUsername' => 'Adasoft',
53            'tSesUsrImagePerson' => NULL,
54            'tSesUsrInfo' => array (
55              'FTUsrStaActive' => 1,
56              'FTUsrLogType' => 1,
57              'FTStaError' => 0,
58              'FTUsrCode' => '00002',
59              'FTUsrName' => 'Adasoft',
60              'FTDptCode' => NULL,
61              'FTDptName' => NULL,
62              'FTImgObj' => NULL,
63            ),
64            'tSesUsrGroup' => array (
65              0 => array (
66                'FTUsrCode' => '00002',
67                'FTAgnCode' => NULL,
68                'FTAgnName' => NULL,
69                'FTBchCode' => NULL,
70                'FTBchName' => NULL,
71                'FTShpCode' => NULL,
72                'FTShpName' => NULL,
73                'FTMerCode' => NULL,
74                'FTMerName' => NULL,
75                'FTWahCode' => NULL,
76                'FTWahName' => NULL,
77                'FTLoginLevel' => 'HQ',
78                'FTStaLoginAgn' => 0,
79              ),
80            ),
81            //'tSesSessionID' => '0000220230123185822',
82            'tSesSessionID' => '0000220230301232726',
83            'tSesSessionDate' => '2023-01-23 18:58:22',
84            'tLangEdit' => 1,
85            'bIsHaveAgn' => NULL,
86            'tSesUsrLevel' => 'HQ',
87            'tSesUsrRoleSpcCodeMulti' => '\'00002\',\'00003\',\'00004\',\'00005\',\'00006\',\'00007\',\'00008\',\'00009\',\'00010\',\'00011\',\'00012\',\'00013\',\'00014\',\'00016\',\'00017\',\'00018\',\'00019\',\'00020\',\'00021\',\'00022\',\'00023\',\'00024\',\'00025\',\'00026\',\'00027\',\'00028\',\'00029\',\'00030\',\'00031\',\'00032\',\'00033\',\'00034\',\'00035\',\'00036\',\'00037\',\'00038\'',
88            'bShpEnabled' => 1,
89            'bAgnEnabled' => 1,
90            'bLockerEnabled' => NULL,
91            'bPdtFasionEnabled' => NULL,
92            'tSesHQBchCode' => '00001',
93            'bSesRegStaLicense' => 1,
94            'tSesCstKey' => '52a8a4705e6c',
95            'bSesRegStaBuyPackage' => 1,
96        );
97    }
98
99    // $route['TWI/(:any)/(:any)']                         = 'document/transferreceiptNew/cTransferreceiptNew/index/$1/$2';
100    // $route['TWITransferReceiptList']                    = 'document/transferreceiptNew/cTransferreceiptNew/FSxCTWITransferReceiptList';
101    // $route['TWITransferReceiptDataTable']               = 'document/transferreceiptNew/cTransferreceiptNew/FSxCTWITransferReceiptDataTable';
102    // $route['TWITransferReceiptPageAdd']                 = 'document/transferreceiptNew/cTransferreceiptNew/FSvCTWITransferReceiptPageAdd';
103    // $route['TWITransferReceiptPageEdit']                = 'document/transferreceiptNew/cTransferreceiptNew/FSvCTWITransferReceiptPageEdit';
104    // $route['TWITransferReceiptPdtAdvanceTableLoadData'] = 'document/transferreceiptNew/cTransferreceiptNew/FSoCTWIPdtAdvTblLoadData';
105    // $route['TWITransferAdvanceTableShowColList']        = 'document/transferreceiptNew/cTransferreceiptNew/FSoCTWIAdvTblShowColList';
106    // $route['TWITransferAdvanceTableShowColSave']        = 'document/transferreceiptNew/cTransferreceiptNew/FSoCTWIAdvTalShowColSave';
107    // $route['TWITransferReceiptAddPdtIntoDTDocTemp']     = 'document/transferreceiptNew/cTransferreceiptNew/FSoCTWIAddPdtIntoDocDTTemp';
108    // $route['TWITransferReceiptRemovePdtInDTTmp']        = 'document/transferreceiptNew/cTransferreceiptNew/FSvCTWIRemovePdtInDTTmp';
109    // $route['TWITransferReceiptRemovePdtInDTTmpMulti']   = 'document/transferreceiptNew/cTransferreceiptNew/FSvCTWIRemovePdtInDTTmpMulti';
110    // $route['dcmTWIEventEdit']                           = 'document/transferreceiptNew/cTransferreceiptNew/FSoCTWIEditEventDoc';
111    // $route['dcmTWIEventAdd']                            = 'document/transferreceiptNew/cTransferreceiptNew/FSoCTWIAddEventDoc';
112    // $route['TWITransferReceiptEventDelete']             = 'document/transferreceiptNew/cTransferreceiptNew/FSoCTWIDeleteEventDoc';
113    // $route['TWITransferReceiptEventCencel']             = 'document/transferreceiptNew/cTransferreceiptNew/FSoCTWIEventCancel';
114    // $route['TWITransferReceiptEventEditInline']         = 'document/transferreceiptNew/cTransferreceiptNew/FSoCTWIEditPdtIntoDocDTTemp';
115    // $route['TWITransferReceiptSelectPDTInCN']           = 'document/transferreceiptNew/cTransferreceiptNew/FSoCTWISelectPDTInCN';
116    // $route['TWITransferReceiptEventApproved']           = 'document/transferreceiptNew/cTransferreceiptNew/FSoCTWIApproved';
117    // $route['TWITransferReceiptRefDoc']                  = 'document/transferreceiptNew/cTransferreceiptNew/FSaCTWIRefDoc';
118    // $route['TWITransferReceiptRefGetWah']               = 'document/transferreceiptNew/cTransferreceiptNew/FSaCTWIGetWahRefDoc';
119    // $route['TWITransferReceiptClearPdtInTmp']           = 'document/transferreceiptNew/cTransferreceiptNew/FSxCTWIClearPdtInTemp';
120
121    // Route : index
122    public function test_TRW01_เข้าหน้าแรกต้องสำเร็จ(){
123        print 'test_TRW01_เข้าหน้าแรกต้องสำเร็จ';
124        $oOutput = $this->request(
125            'POST',
126            'document/transferreceiptNew/cTransferreceiptNew/index/0/0'
127        );
128        $this->assertStringContainsString('odvTRNMainMenu', $oOutput);
129        $this->assertResponseCode(200);
130    }
131
132    // Route : TWITransferReceiptList
133    public function test_TRW02_เข้าหน้าหลักต้องสำเร็จ(){
134        print 'test_TRW02_เข้าหน้าหลักต้องสำเร็จ';
135        $oOutput = $this->request(
136            'POST',
137            'document/transferreceiptNew/cTransferreceiptNew/FSxCTWITransferReceiptList'
138        );
139        $this->assertStringContainsString('odvTRNAdvanceSearchContainer', $oOutput);
140        $this->assertResponseCode(200);
141    }
142
143    // Route : TWITransferReceiptDataTable
144    public function test_TRW03_โหลดข้อมูลรายการเอกสาร_ต้องสำเร็จ(){
145        print 'test_TRW03_โหลดข้อมูลรายการเอกสาร_ต้องสำเร็จ';
146        $aParam = array(
147            'oAdvanceSearch' => array(
148                'tSearchAll'            => '',
149                'tSearchBchCodeFrom'    => '',
150                'tSearchBchCodeTo'      => '',
151                'tSearchDocDateFrom'    => '',
152                'tSearchDocDateTo'      => '',
153                'tSearchStaDoc'         => '0',
154                'tSearchStaDocAct'      => '1',
155                'tSearchStaPrcStk'      => '0',
156            ),
157            'nPageCurrent' => '1',
158        );
159        $oOutput = $this->request(
160            'POST',
161            'document/transferreceiptNew/cTransferreceiptNew/FSxCTWITransferReceiptDataTable',
162            $aParam
163        );
164        $this->assertStringContainsString('Success', $oOutput);
165        $this->assertResponseCode(200);
166    }
167
168    // Route : TWITransferReceiptPageAdd
169    public function test_TRW04_เข้าหน้าจอเพิ่มเอกสาร_ต้องสำเร็จ(){
170        print 'test_TRW04_เข้าหน้าจอเพิ่มเอกสาร_ต้องสำเร็จ';
171        $oOutput = $this->request(
172            'POST',
173            'document/transferreceiptNew/cTransferreceiptNew/FSvCTWITransferReceiptPageAdd'
174        );
175        ob_end_flush();
176        $this->assertStringContainsString('ofmTransferreceiptFormAdd', $oOutput);
177        $this->assertResponseCode(200);
178    }
179
180    // Route : TWITransferReceiptPdtAdvanceTableLoadData
181    public function test_TRW05_โหลดข้อมูลรายการสินค้าแสดงเป็นตาราง_ต้องสำเร็จ(){
182        print 'test_TRW05_โหลดข้อมูลรายการสินค้าแสดงเป็นตาราง_ต้องสำเร็จ';
183        $aParam = array(
184            'ptSearchPdtAdvTable' => '',
185            'ptTWIDocNo'        => '',
186            'ptTWIStaApv'       => '',
187            'ptTWIStaDoc'       => '',
188            'pnTWIPageCurrent'  => '1',
189            'tBCH'              => '00001',
190        );
191        $oOutput = $this->request(
192            'POST',
193            'document/transferreceiptNew/cTransferreceiptNew/FSoCTWIPdtAdvTblLoadData',
194            $aParam
195        );
196        $this->assertStringContainsString('Fucntion Success Return View.', $oOutput);
197        $this->assertResponseCode(200);
198    }
199
200    
201    // Route : TWITransferReceiptAddPdtIntoDTDocTemp
202    public function test_TRW06_เพิ่มสินค้าลงตารางแบบบวกเพิ่มแถวใหม่_1_รายการต้องสำเร็จ(){
203        print 'test_TRW06_เพิ่มสินค้าลงตารางแบบบวกเพิ่มแถวใหม่_1_รายการต้องสำเร็จ';
204        $aParam = array(
205            'tTWIDocNo'     => '',
206            'tBCH'          => '00001',
207            'tTWIPdtData'   => '[{"pnPdtCode":"00084","ptBarCode":"8851907115364","ptPunCode":"00016","packData":{"SHP":"","BCH":"","PDTCode":"00084","PDTName":"สติ๊กเกอร์ SME ตราช้าง ขนาด A15 (46 x 80 mm)","PUNCode":"00016","UnitFact":"1.0000","Barcode":"8851907115364","PUNName":"ชิ้น","IMAGE":"https://dev.ada-soft.com/AdaFileServer/AdaPos5Dev/Adasoft/AdaFile/00001/product/230129163710307ac1eeae667ef.png","LOCSEQ":"","Remark":"สติ๊กเกอร์ SME ตราช้าง ขนาด A15 (46 x 80 mm)","PDTSpc":"GN","CookTime":".0000","CookHeat":".0000","AlwDis":"1","AlwVat":"1","nVat":"7.0000","Price":"0.00","NetAfHD":"0.00"}}]',
208            'tType'         => 'PDT',
209            'nTWIOptionAddPdt' => '2',
210        );
211        $oOutput = $this->request(
212            'POST',
213            'document/transferreceiptNew/cTransferreceiptNew/FSoCTWIAddPdtIntoDocDTTemp',
214            $aParam
215        );
216        $this->assertStringContainsString('Success Add Product Into Document DT Temp.', $oOutput);
217        $this->assertResponseCode(200);
218    }
219
220    // Route : TWITransferReceiptAddPdtIntoDTDocTemp
221    public function test_TRW07_เพิ่มสินค้าลงตารางแบบบวกเพิ่มแถวใหม่__สินค้าตัวเดิม_ต้องสำเร็จ(){
222        print 'test_TRW07_เพิ่มสินค้าลงตารางแบบบวกเพิ่มแถวใหม่__สินค้าตัวเดิม_ต้องสำเร็จ';
223        $aParam = array(
224            'tTWIDocNo'     => '',
225            'tBCH'          => '00001',
226            'tTWIPdtData'   => '[{"pnPdtCode":"00084","ptBarCode":"8851907115364","ptPunCode":"00016","packData":{"SHP":"","BCH":"","PDTCode":"00084","PDTName":"สติ๊กเกอร์ SME ตราช้าง ขนาด A15 (46 x 80 mm)","PUNCode":"00016","UnitFact":"1.0000","Barcode":"8851907115364","PUNName":"ชิ้น","IMAGE":"https://dev.ada-soft.com/AdaFileServer/AdaPos5Dev/Adasoft/AdaFile/00001/product/230129163710307ac1eeae667ef.png","LOCSEQ":"","Remark":"สติ๊กเกอร์ SME ตราช้าง ขนาด A15 (46 x 80 mm)","PDTSpc":"GN","CookTime":".0000","CookHeat":".0000","AlwDis":"1","AlwVat":"1","nVat":"7.0000","Price":"0.00","NetAfHD":"0.00"}}]',
227            'tType'         => 'PDT',
228            'nTWIOptionAddPdt' => '2',
229        );
230        $oOutput = $this->request(
231            'POST',
232            'document/transferreceiptNew/cTransferreceiptNew/FSoCTWIAddPdtIntoDocDTTemp',
233            $aParam
234        );
235        $this->assertStringContainsString('Success Add Product Into Document DT Temp.', $oOutput);
236        $this->assertResponseCode(200);
237    }
238
239    // Route : TWITransferReceiptClearPdtInTmp
240    public function test_TRW08_แก้ไขตัวเลือกกรณีเพิ่มสินค้ารายการเดิม_ต้องสำเร็จ(){
241        print 'test_TRW08_แก้ไขตัวเลือกกรณีเพิ่มสินค้ารายการเดิม_ต้องสำเร็จ';
242        $oOutput = $this->request(
243            'POST',
244            'document/transferreceiptNew/cTransferreceiptNew/FSxCTWIClearPdtInTemp'
245        );
246        $this->assertStringContainsString('', $oOutput);
247        $this->assertResponseCode(200);
248    }
249
250    // Route : TWITransferReceiptAddPdtIntoDTDocTemp
251    public function test_TRW09_เพิ่มสินค้าลงตารางแบบบวกจำนวนในรายการเดิม_1_รายการต้องสำเร็จ(){
252        print 'test_TRW09_เพิ่มสินค้าลงตารางแบบบวกจำนวนในรายการเดิม_1_รายการต้องสำเร็จ';
253        $aParam = array(
254            'tTWIDocNo'     => '',
255            'tBCH'          => '00001',
256            'tTWIPdtData'   => '[{"pnPdtCode":"00082","ptBarCode":"A8851907115272","ptPunCode":"00016","packData":{"SHP":"","BCH":"","PDTCode":"00082","PDTName":"สติ๊กเกอร์ SME ตราช้าง ขนาด A2 (9 x 20)","PUNCode":"00016","UnitFact":"1.0000","Barcode":"A8851907115272","PUNName":"ชิ้น","IMAGE":"https://dev.ada-soft.com/AdaFileServer/AdaPos5Dev/Adasoft/AdaFile/00001/product/23012916311840133403fb966f5.png","LOCSEQ":"","Remark":"สติ๊กเกอร์ SME ตราช้าง ขนาด A2 (9 x 20)","PDTSpc":"GN","CookTime":".0000","CookHeat":".0000","AlwDis":"1","AlwVat":"1","nVat":"7.0000","Price":"0.00","NetAfHD":"0.00"}}]',
257            'tType'         => 'PDT',
258            'nTWIOptionAddPdt' => '1',
259        );
260        $oOutput = $this->request(
261            'POST',
262            'document/transferreceiptNew/cTransferreceiptNew/FSoCTWIAddPdtIntoDocDTTemp',
263            $aParam
264        );
265        $this->assertStringContainsString('Success Add Product Into Document DT Temp.', $oOutput);
266        $this->assertResponseCode(200);
267    }
268
269    // Route : TWITransferReceiptAddPdtIntoDTDocTemp
270    public function test_TRW10_เพิ่มสินค้าลงตารางแบบบวกจำนวนในรายการเดิม_สินค้าตัวเดิม_ต้องสำเร็จ(){
271        print 'test_TRW10_เพิ่มสินค้าลงตารางแบบบวกจำนวนในรายการเดิม_สินค้าตัวเดิม_ต้องสำเร็จ';
272        $aParam = array(
273            'tTWIDocNo'     => '',
274            'tBCH'          => '00001',
275            'tTWIPdtData'   => '[{"pnPdtCode":"00082","ptBarCode":"A8851907115272","ptPunCode":"00016","packData":{"SHP":"","BCH":"","PDTCode":"00082","PDTName":"สติ๊กเกอร์ SME ตราช้าง ขนาด A2 (9 x 20)","PUNCode":"00016","UnitFact":"1.0000","Barcode":"A8851907115272","PUNName":"ชิ้น","IMAGE":"https://dev.ada-soft.com/AdaFileServer/AdaPos5Dev/Adasoft/AdaFile/00001/product/23012916311840133403fb966f5.png","LOCSEQ":"","Remark":"สติ๊กเกอร์ SME ตราช้าง ขนาด A2 (9 x 20)","PDTSpc":"GN","CookTime":".0000","CookHeat":".0000","AlwDis":"1","AlwVat":"1","nVat":"7.0000","Price":"0.00","NetAfHD":"0.00"}}]',
276            'tType'         => 'PDT',
277            'nTWIOptionAddPdt' => '1',
278        );
279        $oOutput = $this->request(
280            'POST',
281            'document/transferreceiptNew/cTransferreceiptNew/FSoCTWIAddPdtIntoDocDTTemp',
282            $aParam
283        );
284        $this->assertStringContainsString('Success Add Product Into Document DT Temp.', $oOutput);
285        $this->assertResponseCode(200);
286    }
287
288    // Route : TWITransferReceiptAddPdtIntoDTDocTemp
289    public function test_TRW11_เพิ่มสินค้าลงตารางแบบบวกจำนวนในรายการเดิม_2_รายการต้องสำเร็จ(){
290        print 'test_TRW11_เพิ่มสินค้าลงตารางแบบบวกจำนวนในรายการเดิม_2_รายการต้องสำเร็จ';
291        $aParam = array(
292            'tTWIDocNo'     => '',
293            'tBCH'          => '00001',
294            'tTWIPdtData'   => '[
295                {"pnPdtCode":"00083","ptPunCode":"00016","ptBarCode":"A8851907115340","packData":{"SHP":"","BCH":"","PDTCode":"00083","PDTName":"สติ๊กเกอร์ SME ตราช้าง ขนาด A11 (30 x 55 mm)","PUNCode":"00016","Barcode":"A8851907115340","PUNName":"ชิ้น","IMAGE":"#e2f0cb","Price":0,"LOCSEQ":"","AlwDis":"1","AlwVat":"1","nVat":"7.0000","NetAfHD":0,"PDTSpc":"-"}},
296                {"pnPdtCode":"00084","ptPunCode":"00016","ptBarCode":"A8851907115364","packData":{"SHP":"","BCH":"","PDTCode":"00084","PDTName":"สติ๊กเกอร์ SME ตราช้าง ขนาด A15 (46 x 80 mm)","PUNCode":"00016","Barcode":"A8851907115364","PUNName":"ชิ้น","IMAGE":"https://dev.ada-soft.com/AdaFileServer/AdaPos5Dev/Adasoft/AdaFile/00001/product/230129163710307ac1eeae667ef.png","Price":0,"LOCSEQ":"","AlwDis":"1","AlwVat":"1","nVat":"7.0000","NetAfHD":0,"PDTSpc":"-"}}
297            ]',
298            'tType'         => 'PDT',
299            'nTWIOptionAddPdt' => '1',
300          );
301        $oOutput = $this->request(
302            'POST',
303            'document/transferreceiptNew/cTransferreceiptNew/FSoCTWIAddPdtIntoDocDTTemp',
304            $aParam
305        );
306        $this->assertStringContainsString('Success Add Product Into Document DT Temp.', $oOutput);
307        $this->assertResponseCode(200);
308    }
309
310    // Route : TWITransferReceiptRemovePdtInDTTmp
311    public function test_TRW12_ลบสินค้าในตาราง_1_รายการต้องสำเร็จ(){
312        print 'test_TRW12_ลบสินค้าในตาราง_1_รายการต้องสำเร็จ';
313        $aParam = array(
314            'tBchCode'  => '00001',
315            'tDocNo'    => '',
316            'nSeqNo'    => '3',
317            'tPdtCode'  => '00084',
318            'tVatInOrEx' => '1',
319          );
320        $oOutput = $this->request(
321            'POST',
322            'document/transferreceiptNew/cTransferreceiptNew/FSvCTWIRemovePdtInDTTmp',
323            $aParam
324        );
325        $this->assertStringContainsString('Success Delete Product', $oOutput);
326        $this->assertResponseCode(200);
327    }
328
329    // Route : TWITransferReceiptRemovePdtInDTTmpMulti
330    public function test_TRW13_ลบสินค้าในตารางหลายรายการ_ต้องสำเร็จ(){
331        print 'test_TRW13_ลบสินค้าในตารางหลายรายการ_ต้องสำเร็จ';
332        $aParam = array(
333            'ptTWIBchCode'      => '00001',
334            'ptTWIDocNo'        => '',
335            'ptTWIVatInOrEx'    => '1',
336            'paDataPdtCode' => array(
337                '0' => '00082',
338                '1' => '00083 ',
339            ),
340            'paDataPunCode' => array(
341                '0' => '00016',
342                '1' => '00016 ',
343            ),
344            'paDataSeqNo' => array(
345                '0' => '1',
346                '1' => '2 ',
347            ),
348          );
349        $oOutput = $this->request(
350            'POST',
351            'document/transferreceiptNew/cTransferreceiptNew/FSvCTWIRemovePdtInDTTmpMulti',
352            $aParam
353        );
354        $this->assertStringContainsString('Success Delete Product', $oOutput);
355        $this->assertResponseCode(200);
356    }
357
358    // Route : TWITransferReceiptRemovePdtInDTTmp
359    public function test_TRW14_เพิ่มสินค้าลงตารางแบบบวกจำนวนในรายการเดิม_3_รายการต้องสำเร็จ(){
360        print 'test_TRW14_เพิ่มสินค้าลงตารางแบบบวกจำนวนในรายการเดิม_3_รายการต้องสำเร็จ';
361        $aParam = array(
362            'tTWIDocNo'     => '',
363            'tBCH'          => '00001',
364            'tTWIPdtData'   => '[
365                {"pnPdtCode":"00082","ptPunCode":"00016","ptBarCode":"A8851907115272","packData":{"SHP":"","BCH":"","PDTCode":"00082","PDTName":"สติ๊กเกอร์ SME ตราช้าง ขนาด A2 (9 x 20)","PUNCode":"00016","UnitFact":"1.0000","Barcode":"A8851907115272","PUNName":"ชิ้น","IMAGE":"https://dev.ada-soft.com/AdaFileServer/AdaPos5Dev/Adasoft/AdaFile/00001/product/23012916311840133403fb966f5.png","LOCSEQ":"","Remark":"สติ๊กเกอร์ SME ตราช้าง ขนาด A2 (9 x 20)","PDTSpc":"GN","CookTime":".0000","CookHeat":".0000","AlwDis":"1","AlwVat":"1","nVat":"7.0000","Price":"0.00","NetAfHD":"0.00"}},
366                {"pnPdtCode":"00083","ptPunCode":"00016","ptBarCode":"A8851907115340","packData":{"SHP":"","BCH":"","PDTCode":"00083","PDTName":"สติ๊กเกอร์ SME ตราช้าง ขนาด A11 (30 x 55 mm)","PUNCode":"00016","Barcode":"A8851907115340","PUNName":"ชิ้น","IMAGE":"#e2f0cb","Price":0,"LOCSEQ":"","AlwDis":"1","AlwVat":"1","nVat":"7.0000","NetAfHD":0,"PDTSpc":"-"}},
367                {"pnPdtCode":"00084","ptPunCode":"00016","ptBarCode":"A8851907115364","packData":{"SHP":"","BCH":"","PDTCode":"00084","PDTName":"สติ๊กเกอร์ SME ตราช้าง ขนาด A15 (46 x 80 mm)","PUNCode":"00016","Barcode":"A8851907115364","PUNName":"ชิ้น","IMAGE":"https://dev.ada-soft.com/AdaFileServer/AdaPos5Dev/Adasoft/AdaFile/00001/product/230129163710307ac1eeae667ef.png","Price":0,"LOCSEQ":"","AlwDis":"1","AlwVat":"1","nVat":"7.0000","NetAfHD":0,"PDTSpc":"-"}}
368            ]',
369            'tType'         => 'PDT',
370            'nTWIOptionAddPdt' => '1',
371          );
372        $oOutput = $this->request(
373            'POST',
374            'document/transferreceiptNew/cTransferreceiptNew/FSoCTWIAddPdtIntoDocDTTemp',
375            $aParam
376        );
377        $this->assertStringContainsString('Success Add Product Into Document DT Temp.', $oOutput);
378        $this->assertResponseCode(200);
379    }
380
381    // Route : TWITransferReceiptEventEditInline
382    public function test_TRW15_แก้ไขจำนวนของสินค้ารายการที่_1_ต้องสำเร็จ(){
383        print 'test_TRW15_แก้ไขจำนวนของสินค้ารายการที่_1_ต้องสำเร็จ';
384        $aParam = array(
385            'tTWIBchCode'   => '00001',
386            'tTWIDocNo'     => '',
387            'tTWIVATInOrEx' => '1',
388            'nTWISeqNo'     => '1',
389            'tTWIFieldName' => 'FCXtdQty',
390            'tTWIValue'     => '10',
391        );
392        $oOutput = $this->request(
393            'POST',
394            'document/transferreceiptNew/cTransferreceiptNew/FSoCTWIEditPdtIntoDocDTTemp',
395            $aParam
396        );
397        $this->assertStringContainsString('Update And Calcurate Process Document DT Temp Success.', $oOutput);
398        $this->assertResponseCode(200);
399    }
400
401    // Route : TWITransferReceiptEventEditInline
402    public function test_TRW16_แก้ไขราคาต่อหน่วยของสินค้ารายการที่_2_ต้องสำเร็จ(){
403        print 'test_TRW16_แก้ไขราคาต่อหน่วยของสินค้ารายการที่_2_ต้องสำเร็จ';
404        $aParam = array(
405            'tTWIBchCode'   => '00001',
406            'tTWIDocNo'     => '',
407            'tTWIVATInOrEx' => '1',
408            'nTWISeqNo'     => '2',
409            'tTWIFieldName' => 'FCXtdSetPrice',
410            'tTWIValue'     => '30',
411        );
412        $oOutput = $this->request(
413            'POST',
414            'document/transferreceiptNew/cTransferreceiptNew/FSoCTWIEditPdtIntoDocDTTemp',
415            $aParam
416        );
417        $this->assertStringContainsString('Update And Calcurate Process Document DT Temp Success.', $oOutput);
418        $this->assertResponseCode(200);
419    }
420
421    // Route : dcmTWIEventAdd
422    public function test_TRW17_บันทึกเอกสาร_ต้องสำเร็จ(){
423        print 'test_TRW17_บันทึกเอกสาร_ต้องสำเร็จ';
424        $aParam = array(
425            'ohdTWICompCode' => '00001',
426            'ohdBaseUrl' => 'http://localhost/AdaPos5.0-STD/',
427            'ohdTWIRoute' => 'dcmTWIEventAdd',
428            'ohdTWICheckClearValidate' => '0',
429            'ohdTWICheckSubmitByButton' => '0',
430            'ohdTWIAutStaEdit' => '0',
431            'ohdTWIStaApv' => '',
432            'ohdTWIStaDoc' => '',
433            'ohdTWIStaPrcStk' => '',
434            'ohdTWIStaDelMQ' => '',
435            'ohdTWISesUsrBchCode' => '00001',
436            'ohdTWIBchCode' => '00001',
437            'ohdTWIDptCode' => '',
438            'ohdTWIUsrCode' => '00002',
439            'ohdTWIApvCodeUsrLogin' => '00002',
440            'ohdTWILangEdit' => '1',
441            'ohdTWIFrmSplInfoVatInOrEx' => '1',
442            'ohdTWIObjPdtFhnCallBack' => '[
443                {"pnPdtCode":"00084","ptBarCode":"8851907115364","ptPunCode":"00016","packData":{"SHP":"","BCH":"","PDTCode":"00084","PDTName":"\u0e2a\u0e15\u0e34\u0e4a\u0e01\u0e40\u0e01\u0e2d\u0e23\u0e4c SME \u0e15\u0e23\u0e32\u0e0a\u0e49\u0e32\u0e07 \u0e02\u0e19\u0e32\u0e14 A15 (46 x 80 mm)","PUNCode":"00016","UnitFact":"1.0000","Barcode":"8851907115364","PUNName":"\u0e0a\u0e34\u0e49\u0e19","IMAGE":"https:\/\/dev.ada-soft.com\/AdaFileServer\/AdaPos5Dev\/Adasoft\/AdaFile\/00001\/product\/230129163710307ac1eeae667ef.png","LOCSEQ":"","Remark":"\u0e2a\u0e15\u0e34\u0e4a\u0e01\u0e40\u0e01\u0e2d\u0e23\u0e4c SME \u0e15\u0e23\u0e32\u0e0a\u0e49\u0e32\u0e07 \u0e02\u0e19\u0e32\u0e14 A15 (46 x 80 mm)","PDTSpc":"GN","CookTime":".0000","CookHeat":".0000","AlwDis":"1","AlwVat":"1","nVat":"7.0000","Price":"0.00","NetAfHD":"0.00"}},
444                {"pnPdtCode":"00084","ptBarCode":"A8851907115364","ptPunCode":"00016","packData":{"SHP":"","BCH":"","PDTCode":"00084","PDTName":"\u0e2a\u0e15\u0e34\u0e4a\u0e01\u0e40\u0e01\u0e2d\u0e23\u0e4c SME \u0e15\u0e23\u0e32\u0e0a\u0e49\u0e32\u0e07 \u0e02\u0e19\u0e32\u0e14 A15 (46 x 80 mm)","PUNCode":"00016","UnitFact":"1.0000","Barcode":"A8851907115364","PUNName":"\u0e0a\u0e34\u0e49\u0e19","IMAGE":"https:\/\/dev.ada-soft.com\/AdaFileServer\/AdaPos5Dev\/Adasoft\/AdaFile\/00001\/product\/230129163710307ac1eeae667ef.png","LOCSEQ":"","Remark":"\u0e2a\u0e15\u0e34\u0e4a\u0e01\u0e40\u0e01\u0e2d\u0e23\u0e4c SME \u0e15\u0e23\u0e32\u0e0a\u0e49\u0e32\u0e07 \u0e02\u0e19\u0e32\u0e14 A15 (46 x 80 mm)","PDTSpc":"GN","CookTime":".0000","CookHeat":".0000","AlwDis":"1","AlwVat":"1","nVat":"7.0000","Price":"0.00","NetAfHD":"0.00"}}
445            ]',
446            'ohdCheckTWISubmitByButton' => '0',
447            'ohdCheckTWIClearValidate' => '0',
448            'ocbTWIStaAutoGenCode' => '1',
449            'oetTWIDocNo' => '',
450            'ohdTWICheckDuplicateCode' => '2',
451            'oetTWIDocDate' => '2023-04-12',
452            'oetTWIDocTime' => '02:25:00',
453            'ohdTWICreateBy' => 'Adasoft',
454            'oetTWIFrmBchName' => 'AdaSoft00001',
455            'oetSOFrmBchCode' => '00001',
456            'oetTROutShpFromName' => '',
457            'oetTROutShpFromCode' => '',
458            'oetTROutPosFromName' => '',
459            'oetTROutPosFromCode' => '',
460            'oetTWIRefIntDocNo' => '',
461            'oetTWIRefIntDocCode' => '',
462            'oetTROutWahFromName' => 'คลังสต๊อก',
463            'oetTROutWahFromCode' => '00002',
464            'oetTROutShpToName' => '',
465            'oetTROutShpToCode' => '',
466            'oetTROutPosToName' => '',
467            'oetTROutPosToCode' => '',
468            'oetTROutWahToName' => 'คลังทดสอบ',
469            'oetTROutWahToCode' => '00003',
470            'oetTWIRefIntDoc' => '',
471            'oetTWIRefIntDocDate' => '',
472            'oetTWIRefExtDoc' => '',
473            'oetTWIRefExtDocDate' => '',
474            'oetTWITransportCtrName' => '',
475            'oetTWITransportTnfDate' => '',
476            'oetTWITransportRefTnfID' => '',
477            'oetTWITransportRefVehID' => '',
478            'oetTWITransportQtyAndTypeUnit' => '',
479            'oetTWIUpVendingViaName' => '',
480            'oetTWIUpVendingViaCode' => '',
481            'ohdTWIFrmShipAdd' => '',
482            'oetTWIReasonName' => '',
483            'oetTWIReasonCode' => '',
484            'otaTWIFrmInfoOthRmk' => '',
485            'ocmTWIOptionAddPdt' => '1',
486            'ocmTWIFrmInfoOthDocPrint' => '',
487            'ocbTWIStaDocAct' => '1',
488            'oetTWIFrmFilterPdtHTML' => '',
489            'oetTWIFrmSearchAndAddPdtHTML' => '',
490            'oetTWIInsertBarcode' => '',
491            'ohdFCXtdQty1' => '10.00',
492            'ohdFCXtdSetPrice1' => '0.00',
493            'ohdFCXtdQty2' => '1.00',
494            'ohdFCXtdSetPrice2' => '30.00',
495            'ohdFCXtdQty3' => '1.00',
496            'ohdFCXtdSetPrice3' => '0.00',
497            'ohdTWIShipAddSeqNo' => '',
498        );
499        $oOutput = $this->request(
500            'POST',
501            'document/transferreceiptNew/cTransferreceiptNew/FSoCTWIAddEventDoc',
502            $aParam
503        );
504        $this->assertStringContainsString('Success Add Document.', $oOutput);
505        $this->assertResponseCode(200);
506    }
507
508    // Route : TWITransferReceiptPageEdit
509    public function test_TRW18_เข้าหน้าจอแก้ไขเอกสาร_ต้องสำเร็จ(){
510        print 'test_TRW18_เข้าหน้าจอแก้ไขเอกสาร_ต้องสำเร็จ';
511        $ci = &get_instance();
512        $ci->load->database();
513        $tSql = " SELECT TOP 1 FTXthDocNo FROM TCNTPdtTwiHD WITH(NOLOCK)  WHERE ISNULL(FTXthStaApv,'') = '' AND  ISNULL(FNXthDocType,'') = '5' ";
514        $aResult = $ci->db->query($tSql);
515        $aPdtData = $aResult->row_array();
516        if(!empty($aPdtData)){
517            $aParam = array(
518                'ptDocNumber' => $aPdtData['FTXthDocNo'],
519            );
520            $oOutput = $this->request(
521                'POST',
522                'document/transferreceiptNew/cTransferreceiptNew/FSvCTWITransferReceiptPageEdit',
523                $aParam
524            );
525            ob_end_flush();
526            $this->assertStringContainsString('ofmTransferreceiptFormAdd', $oOutput);
527            $this->assertResponseCode(200);
528        }
529    }
530
531    // Route : TWITransferReceiptEventApproved
532    public function test_TRW19_อนุมัติเอกสาร_ต้องสำเร็จ(){
533        print 'test_TRW19_อนุมัติเอกสาร_ต้องสำเร็จ';
534        $ci = &get_instance();
535        $ci->load->database();
536        $tSql = " SELECT TOP 1 FTXthDocNo, FTXthStaApv, FTBchCode FROM TCNTPdtTwiHD WITH(NOLOCK) WHERE ISNULL(FTXthStaApv,'') = '' AND ISNULL(FTXthStaDoc,'') != '3' AND  ISNULL(FNXthDocType,'') = '5' ";
537        $aResult = $ci->db->query($tSql);
538        $aPdtData = $aResult->row_array();
539        if(!empty($aPdtData)){
540            $aParam = array(
541                'tXthDocNo'     => $aPdtData['FTXthDocNo'],
542                'tXthStaApv'    => $aPdtData['FTXthStaApv'],
543                'tXthBchCode'   => $aPdtData['FTBchCode'],
544            );
545            $oOutput = $this->request(
546                'POST',
547                'document/transferreceiptNew/cTransferreceiptNew/FSoCTWIApproved',
548                $aParam
549            );
550            $this->assertStringContainsString('ok', $oOutput);
551            $this->assertResponseCode(200);
552        }
553    }
554
555    // Route : TWITransferReceiptEventCencel
556    public function test_TRW20_ยกเลิกเอกสาร_ต้องสำเร็จ(){
557        print 'test_TRW20_ยกเลิกเอกสาร_ต้องสำเร็จ';
558        $ci = &get_instance();
559        $ci->load->database();
560        $tSql = " SELECT TOP 1 FTXthDocNo FROM TCNTPdtTwiHD WITH(NOLOCK) WHERE ISNULL(FTXthStaApv,'') = '' AND  ISNULL(FTXthStaDoc,'') != '3' AND  ISNULL(FNXthDocType,'') = '5' ";
561        $aResult = $ci->db->query($tSql);
562        $aPdtData = $aResult->row_array();
563        if(!empty($aPdtData)){
564            $aParam = array(
565                'tTWIDocNo' => $aPdtData['FTXthDocNo'],
566            );
567            $oOutput = $this->request(
568                'POST',
569                'document/transferreceiptNew/cTransferreceiptNew/FSoCTWIEventCancel',
570                $aParam
571            );
572            $this->assertStringContainsString('Cancel done.', $oOutput);
573            $this->assertResponseCode(200);
574        }
575    }
576
577    // Route : TWITransferReceiptEventDelete
578    public function test_TRW21_ลบเอกสาร_1_เอกสารต้องสำเร็จ(){
579        print 'test_TRW21_ลบเอกสาร_1_เอกสารต้องสำเร็จ';
580        $ci = &get_instance();
581        $ci->load->database();
582        $tSql = " SELECT TOP 1 FTXthDocNo FROM TCNTPdtTwiHD WITH(NOLOCK) WHERE ISNULL(FTXthStaApv,'') = '' AND  ISNULL(FTXthStaDoc,'') != '3' AND  ISNULL(FNXthDocType,'') = '5' ";
583        $aResult = $ci->db->query($tSql);
584        $aPdtData = $aResult->row_array();
585        if(!empty($aPdtData)){
586            $aParam = array(
587                'tTWIDocNo' => $aPdtData['FTXthDocNo'],
588            );
589            $oOutput = $this->request(
590                'POST',
591                'document/transferreceiptNew/cTransferreceiptNew/FSoCTWIDeleteEventDoc',
592                $aParam
593            );
594            $this->assertStringContainsString('Success', $oOutput);
595            $this->assertResponseCode(200);
596        }
597    }
598
599    // Route : TWITransferReceiptEventDelete
600    public function test_TRW22_ลบเอกสาร_2_เอกสารต้องสำเร็จ(){
601        print 'test_TRW22_ลบเอกสาร_2_เอกสารต้องสำเร็จ';
602        $ci = &get_instance();
603        $ci->load->database();
604        $tSql = " SELECT TOP 2 FTXthDocNo FROM TCNTPdtTwiHD WITH(NOLOCK) WHERE ISNULL(FTXthStaApv,'') = '' AND  ISNULL(FTXthStaDoc,'') != '3' AND  ISNULL(FNXthDocType,'') = '5' ";
605        $aResult = $ci->db->query($tSql);
606        $aPdtDataObj = $aResult->result_array();
607        if(!empty($aPdtDataObj)){
608
609            foreach($aPdtDataObj as $aPdtData){
610                $aParam['tTWIDocNo'][] = $aPdtData['FTXthDocNo'];
611            }
612            $oOutput = $this->request(
613                'POST',
614                'document/transferreceiptNew/cTransferreceiptNew/FSoCTWIDeleteEventDoc',
615                $aParam
616            );
617            $this->assertStringContainsString('Success', $oOutput);
618            $this->assertResponseCode(200);
619        }
620    }
621}