Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 828
0.00% covered (danger)
0.00%
0 / 22
CRAP
0.00% covered (danger)
0.00%
0 / 1
SaleOrder_test
0.00% covered (danger)
0.00%
0 / 828
0.00% covered (danger)
0.00%
0 / 22
552
0.00% covered (danger)
0.00%
0 / 1
 __construct
n/a
0 / 0
n/a
0 / 0
1
 test_SO_เข้าหน้าแรกต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 1
2
 test_SO_โหลดข้อมูลตัวกรอง
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 1
2
 test_SO_โหลดข้อมูลมาแสดงเป็นตารางต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 23
0.00% covered (danger)
0.00%
0 / 1
2
 test_SO_โหลดข้อมูลมาแสดงเป็นตารางแบบมีเงื่อนไขหน้า_2_ต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 23
0.00% covered (danger)
0.00%
0 / 1
2
 test_SO_โหลดข้อมูลมาแสดงเป็นตารางแบบมีเงื่อนไขหน้า_2_และมีการกรองต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 23
0.00% covered (danger)
0.00%
0 / 1
2
 test_SO_เปิดหน้าเพิ่มเอกสารต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 1
2
 test_SO_โหลดข้อมูลรายการสินค้าแสดงเป็นตารางต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 17
0.00% covered (danger)
0.00%
0 / 1
2
 test_SO_เพิ่มข้อมูลสินค้า_1_รายการต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 27
0.00% covered (danger)
0.00%
0 / 1
2
 test_SO_เพิ่มข้อมูลสินค้า_2_รายการต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 28
0.00% covered (danger)
0.00%
0 / 1
2
 test_SO_แก้ไขราคาสินค้าลำดับที่_1_เป็นจำนวนเงิน_150_บาท
0.00% covered (danger)
0.00%
0 / 25
0.00% covered (danger)
0.00%
0 / 1
2
 test_SO_ค้นหาสินค้าในรายการเอกสารต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 17
0.00% covered (danger)
0.00%
0 / 1
2
 test_SO_ลบข้อมูลสินค้า_1_รายการต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 23
0.00% covered (danger)
0.00%
0 / 1
2
 test_SO_ลบข้อมูลสินค้า_2_รายการต้องสำเร็จ
0.00% covered (danger)
0.00%
0 / 29
0.00% covered (danger)
0.00%
0 / 1
2
 test_SO_บันทึกเอกสาร_กำหนดเงื่อนไขครบถ้วน
0.00% covered (danger)
0.00%
0 / 88
0.00% covered (danger)
0.00%
0 / 1
2
 test_SO_บันทึกเอกสาร_กำหนดบางเงื่อนไข
0.00% covered (danger)
0.00%
0 / 88
0.00% covered (danger)
0.00%
0 / 1
2
 test_SO_บันทึกเอกสาร_กรอกข้อมูลที่ยาวเกินขนาดของฟิวด์
0.00% covered (danger)
0.00%
0 / 160
0.00% covered (danger)
0.00%
0 / 1
2
 test_SO_บันทึกเอกสาร_กรอกข้อมูลที่ผิดประเภทของฟิวด์
0.00% covered (danger)
0.00%
0 / 160
0.00% covered (danger)
0.00%
0 / 1
2
 test_SO_โหลดข้อมูลหน้าจอแก้ไขเอกสาร
0.00% covered (danger)
0.00%
0 / 14
0.00% covered (danger)
0.00%
0 / 1
2
 test_SO_ยกเลิกเอกสาร
0.00% covered (danger)
0.00%
0 / 14
0.00% covered (danger)
0.00%
0 / 1
2
 test_SO_อนุมัติเอกสาร
0.00% covered (danger)
0.00%
0 / 17
0.00% covered (danger)
0.00%
0 / 1
2
 test_SO_ลบเอกสาร_1_รายการ
0.00% covered (danger)
0.00%
0 / 14
0.00% covered (danger)
0.00%
0 / 1
2
 test_SO_ลบเอกสาร_2_รายการ
0.00% covered (danger)
0.00%
0 / 17
0.00% covered (danger)
0.00%
0 / 1
2
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
11class SaleOrder_test extends TestCase
12{
13
14    /** 
15     *@codeCoverageIgnore
16    */
17    public function __construct() {
18        parent::__construct();
19        $ci = &get_instance();
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            'tSesUsrMerName' => 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' => TRUE,
48            'tSesUserCode' => '00002',
49            'tSesUsername' => '00002',
50            'tSesUsrDptName' => NULL,
51            'tSesUsrDptCode' => NULL,
52            'tSesUsrUsername' => 'Adasoft',
53            'tSesUsrImagePerson' => NULL,
54            'tSesUsrInfo' => 
55            array (
56              'FTUsrStaActive' => 1,
57              'FTUsrLogType' => 1,
58              'FTStaError' => 0,
59              'FTUsrCode' => '00002',
60              'FTUsrName' => 'Adasoft',
61              'FTDptCode' => NULL,
62              'FTDptName' => NULL,
63              'FTImgObj' => NULL,
64            ),
65            'tSesUsrGroup' => 
66            array (
67              0 => 
68              array (
69                'FTUsrCode' => '00002',
70                'FTAgnCode' => NULL,
71                'FTAgnName' => NULL,
72                'FTBchCode' => NULL,
73                'FTBchName' => NULL,
74                'FTShpCode' => NULL,
75                'FTShpName' => NULL,
76                'FTMerCode' => NULL,
77                'FTMerName' => NULL,
78                'FTWahCode' => NULL,
79                'FTWahName' => NULL,
80                'FTLoginLevel' => 'HQ',
81                'FTStaLoginAgn' => 0,
82              ),
83            ),
84            'tSesSessionID' => '0000220230123185822',
85            'tSesSessionDate' => '2023-01-23 18:58:22',
86            'tLangEdit' => 1,
87            'bIsHaveAgn' => NULL,
88            'tSesUsrLevel' => 'HQ',
89            '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\'',
90            'bShpEnabled' => 1,
91            'bAgnEnabled' => 1,
92            'bLockerEnabled' => NULL,
93            'bPdtFasionEnabled' => NULL,
94            'tSesHQBchCode' => '00001',
95            'bSesRegStaLicense' => 1,
96            'tSesCstKey' => '52a8a4705e6c',
97            'bSesRegStaBuyPackage' => 1,
98        );
99
100        $_COOKIE['nBrwTopWebCookie_00002'] = 50;
101        $_COOKIE['nSesTopPdt_00002'] = 50;
102    }
103
104
105    //1.เข้าหน้าแรกต้องสำเร็จ
106    public function test_SO_เข้าหน้าแรกต้องสำเร็จ(){
107        print " 1.เข้าหน้าแรกต้องสำเร็จ \n";
108        $oOutput = $this->request(
109            'POST',
110            'document/saleorder/cSaleOrder/index/0/0'
111        );
112        $this->assertStringContainsString('oetSOStaBrowse', $oOutput);
113        $this->assertResponseCode(200);
114    }
115
116     //2.เข้าหน้าหลักต้องสำเร็จ
117     public function test_SO_โหลดข้อมูลตัวกรอง(){
118        print " 2.โหลดข้อมูลตัวกรอง \n";
119        $oOutput = $this->request(
120            'POST',
121            'document/saleorder/cSaleOrder/FSvCSOFormSearchList'
122        );
123        $this->assertStringContainsString('obtSOSerchAllDocument', $oOutput);
124        $this->assertResponseCode(200);
125    }
126
127
128    //3.โหลดข้อมูลมาแสดงเป็นตารางต้องสำเร็จ
129    public function test_SO_โหลดข้อมูลมาแสดงเป็นตารางต้องสำเร็จ(){
130    print " 3.โหลดข้อมูลมาแสดงเป็นตารางต้องสำเร็จ \n";
131        $aParam = array(
132            'oAdvanceSearchData' => array(
133                'tSearchAll'=> '',
134                'tSearchBchCodeFrom'=> '',
135                'tSearchBchCodeTo' => '',
136                'tSearchDocDateFrom' => '',
137                'tSearchDocDateTo' => '',
138                'tSearchStaDoc' => '',
139                'tSearchStaAct' => '',
140                'tSearchStaPrcStk' => '',
141                'tSearchUsedStatus' => ''
142            ),
143            'nPageCurrent' => 1
144        );
145        $oOutput = $this->request(
146            'POST',
147            'document/saleorder/cSaleOrder/FSoCSODataTable',
148            $aParam
149        );
150        $this->assertStringContainsString('otbSOTblDataDocHDList', $oOutput);
151        $this->assertResponseCode(200);
152        ob_get_clean();
153    }
154
155
156        //4.โหลดข้อมูลมาแสดงเป็นตารางต้องสำเร็จ
157        public function test_SO_โหลดข้อมูลมาแสดงเป็นตารางแบบมีเงื่อนไขหน้า_2_ต้องสำเร็จ(){
158            print " 4.โหลดข้อมูลมาแสดงเป็นตารางแบบมีเงื่อนไขหน้า_2_ต้องสำเร็จ \n";
159                $aParam = array(
160                    'oAdvanceSearchData' => array(
161                        'tSearchAll'=> '',
162                        'tSearchBchCodeFrom'=> '',
163                        'tSearchBchCodeTo' => '',
164                        'tSearchDocDateFrom' => '',
165                        'tSearchDocDateTo' => '',
166                        'tSearchStaDoc' => '',
167                        'tSearchStaAct' => '',
168                        'tSearchStaPrcStk' => '',
169                        'tSearchUsedStatus' => ''
170                    ),
171                    'nPageCurrent' => 2
172                );
173                $oOutput = $this->request(
174                    'POST',
175                    'document/saleorder/cSaleOrder/FSoCSODataTable',
176                    $aParam
177                );
178                $this->assertStringContainsString('otbSOTblDataDocHDList', $oOutput);
179                $this->assertResponseCode(200);
180                ob_get_clean();
181            }
182
183            
184        //4.โหลดข้อมูลมาแสดงเป็นตารางต้องสำเร็จ
185        public function test_SO_โหลดข้อมูลมาแสดงเป็นตารางแบบมีเงื่อนไขหน้า_2_และมีการกรองต้องสำเร็จ(){
186            print " 5.โหลดข้อมูลมาแสดงเป็นตารางแบบมีเงื่อนไขหน้า_2_และมีการกรองต้องสำเร็จ \n";
187                $aParam = array(
188                    'oAdvanceSearchData' => array(
189                        'tSearchAll'=> '00001',
190                        'tSearchBchCodeFrom'=> '',
191                        'tSearchBchCodeTo' => '',
192                        'tSearchDocDateFrom' => '',
193                        'tSearchDocDateTo' => '',
194                        'tSearchStaDoc' => '',
195                        'tSearchStaAct' => '',
196                        'tSearchStaPrcStk' => '',
197                        'tSearchUsedStatus' => ''
198                    ),
199                    'nPageCurrent' => 2
200                );
201                $oOutput = $this->request(
202                    'POST',
203                    'document/saleorder/cSaleOrder/FSoCSODataTable',
204                    $aParam
205                );
206                $this->assertStringContainsString('otbSOTblDataDocHDList', $oOutput);
207                $this->assertResponseCode(200);
208                ob_get_clean();
209            }
210
211
212
213        //4.เปิดหน้าเพิ่มเอกสารต้องสำเร็จห
214        public function test_SO_เปิดหน้าเพิ่มเอกสารต้องสำเร็จ(){
215            print " 6.เปิดหน้าเพิ่มเอกสารต้องสำเร็จ\n";
216
217                $oOutput = $this->request(
218                    'POST',
219                    'document/saleorder/cSaleOrder/FSoCSOAddPage',
220                );
221                $this->assertStringContainsString('odvSODataPanelDetailPDT', $oOutput);
222                $this->assertResponseCode(200);
223        }
224
225
226
227        
228        //5.โหลดข้อมูลรายการสินค้าแสดงเป็นตารางต้องสำเร็จ
229        public function test_SO_โหลดข้อมูลรายการสินค้าแสดงเป็นตารางต้องสำเร็จ(){
230            print " 7.โหลดข้อมูลรายการสินค้าแสดงเป็นตารางต้องสำเร็จ\n";
231            $aParam = array(
232                'tSelectBCH' => '00001',
233                'ptSearchPdtAdvTable' => '',
234                'ptSODocNo' => '',
235                'ptSOStaApv' => '',
236                'ptSOStaDoc' => '1',
237                'ptSOVATInOrEx' => '1',
238                'pnSOPageCurrent' => '1',
239              );
240                $oOutput = $this->request(
241                    'POST',
242                    'document/saleorder/cSaleOrder/FSoCSOPdtAdvTblLoadData',
243                    $aParam
244                );
245                $this->assertStringContainsString('Fucntion Success Return View', $oOutput);
246                $this->assertResponseCode(200);
247                // ob_end_flush();
248        }
249
250        
251
252        //6.เพิ่มข้อมูลสินค้า_1_รายการต้องสำเร็จ
253        public function test_SO_เพิ่มข้อมูลสินค้า_1_รายการต้องสำเร็จ(){
254            print " 8.เพิ่มข้อมูลสินค้า_1_รายการต้องสำเร็จ\n";
255            $ci = &get_instance();
256            $ci->load->database();
257            
258                    $aParam = array(
259                        'tSelectBCH' => '00001',
260                        'tSODocNo' => '',
261                        'tSOVATInOrEx' => '1',
262                        'tSOOptionAddPdt' => '2',
263                        'tSOPdtData: ' => array(
264'{"pnPdtCode":"00148","ptPunCode":"00012","ptBarCode":"889999918273","packData":{"SHP":"","BCH":"","PDTCode":"00148","PDTName":"LED 200 ตะเกียงแคมป์","Barcode":"889999918273","PUNCode":"00012","PUNName":"อัน","UnitFact":"1.0000","PriceRet":"450.00","PriceWhs":"0.00","PriceNet":"0.00","IMAGE":"https://dev.ada-soft.com/AdaFileServer/AdaPos5Dev/Adasoft/AdaFile/00017/product/2302151320287631ef4f0c6fe1f.png","LOCSEQ":"","Remark":"LED 200 ตะเกียงแคมป์","CookTime":".0000","CookHeat":".0000","AlwDis":"1","AlwVat":"1","nVat":"7.0000","NetAfHD":"450.00","PDTSpc":"-"}}]',
265                        ),
266                        'tSOPplCodeBch' => '',
267                        'tSOPplCodeCst' => '00003',
268                        'ohdSesSessionID' => '0000220230323103400',
269                        'ohdSOUsrCode' => '00002',
270                        'ohdSOLangEdit' => '1',
271                        'ohdSesUsrLevel' => 'HQ',
272                        'ohdSOSesUsrBchCode' => '',
273                        'tSeqNo' => '1',
274                      );
275                $oOutput = $this->request(
276                    'POST',
277                    'document/saleorder/cSaleOrder/FSoCSOAddPdtIntoDocDTTemp',
278                    $aParam
279                );
280                $this->assertStringContainsString('Success Add Product Into Document DT Temp', $oOutput);
281                $this->assertResponseCode(200);
282
283            
284        }
285
286        
287        
288        
289        //8.เพิ่มข้อมูลสินค้า_2_รายการต้องสำเร็จ
290        public function test_SO_เพิ่มข้อมูลสินค้า_2_รายการต้องสำเร็จ(){
291            print " 9.เพิ่มข้อมูลสินค้า_2_รายการต้องสำเร็จ\n";
292            $ci = &get_instance();
293            $ci->load->database();
294            
295
296                $aParam = array(
297                    'tSelectBCH' => '00001',
298                    'tSODocNo' => '',
299                    'tSOVATInOrEx' => '1',
300                    'tSOOptionAddPdt' => '2',
301                    'tSOPdtData: ' => array(
302                        '{"pnPdtCode":"00156","ptPunCode":"00001","ptBarCode":"T-0001","packData":{"SHP":"","BCH":"","PDTCode":"00156","PDTName":"สินค้าผูกผู้จำหน่าย","Barcode":"T-0001","PUNCode":"00001","PUNName":"ขวด","UnitFact":"1.0000","PriceRet":"0.00","PriceWhs":"0.00","PriceNet":"0.00","IMAGE":"#ee2d24","LOCSEQ":"","Remark":"สินค้าผูกผู้จำหน่าย","CookTime":".0000","CookHeat":".0000","AlwDis":"1","AlwVat":"1","nVat":"7.0000","NetAfHD":"0.00","PDTSpc":"-"}}]',                
303'{"pnPdtCode":"00148","ptPunCode":"00012","ptBarCode":"889999918273","packData":{"SHP":"","BCH":"","PDTCode":"00148","PDTName":"LED 200 ตะเกียงแคมป์","Barcode":"889999918273","PUNCode":"00012","PUNName":"อัน","UnitFact":"1.0000","PriceRet":"450.00","PriceWhs":"0.00","PriceNet":"0.00","IMAGE":"https://dev.ada-soft.com/AdaFileServer/AdaPos5Dev/Adasoft/AdaFile/00017/product/2302151320287631ef4f0c6fe1f.png","LOCSEQ":"","Remark":"LED 200 ตะเกียงแคมป์","CookTime":".0000","CookHeat":".0000","AlwDis":"1","AlwVat":"1","nVat":"7.0000","NetAfHD":"450.00","PDTSpc":"-"}}]',
304),
305                    'tSOPplCodeBch' => '',
306                    'tSOPplCodeCst' => '00003',
307                    'ohdSesSessionID' => '0000220230323103400',
308                    'ohdSOUsrCode' => '00002',
309                    'ohdSOLangEdit' => '1',
310                    'ohdSesUsrLevel' => 'HQ',
311                    'ohdSOSesUsrBchCode' => '',
312                    'tSeqNo' => '1',
313                    );
314                    $oOutput = $this->request(
315                        'POST',
316                        'document/saleorder/cSaleOrder/FSoCSOAddPdtIntoDocDTTemp',
317                        $aParam
318                    );
319                    $this->assertStringContainsString('Success Add Product Into Document DT Temp', $oOutput);
320                    $this->assertResponseCode(200);
321                
322        }
323
324
325
326
327        /**
328         * @large
329         */
330        public function test_SO_แก้ไขราคาสินค้าลำดับที่_1_เป็นจำนวนเงิน_150_บาท(){
331            print " 10.แก้ไขราคาสินค้าลำดับที่_1_เป็นจำนวนเงิน_150_บาท\n";
332            $ci = &get_instance();
333            $ci->load->database();
334            $tSesSessionID = $_SESSION['tSesSessionID'];
335    
336                $aParam = array(
337                    'tSOBchCode' => '00001',
338                    'tSODocNo' => '',
339                    'nSOSeqNo' => '1',
340                    'nQty' => '1',
341                    'cPrice' => '150',
342                    'cNet' => '150',
343                    'nStaDelDis' => '0',
344                    'ohdSesSessionID' => '0000220230323103400',
345                    'ohdSOUsrCode' => '00002',
346                    'ohdSOLangEdit' => '1',
347                    'ohdSesUsrLevel' => 'HQ',
348                    'ohdSOSesUsrBchCode' => '',
349                  );
350                $oOutput = $this->request(
351                    'POST',
352                    'document/saleorder/cSaleOrder/FSoCSOEditPdtIntoDocDTTemp',
353                    $aParam
354                );
355                $this->assertStringContainsString('Update Inline Into Document DT Temp', $oOutput);
356                $this->assertResponseCode(200);
357            
358        
359        }
360
361
362        //5.โหลดข้อมูลรายการสินค้าแสดงเป็นตารางต้องสำเร็จ
363        public function test_SO_ค้นหาสินค้าในรายการเอกสารต้องสำเร็จ(){
364            print " 11.ค้นหาสินค้าในรายการเอกสารต้องสำเร็จ\n";
365            $aParam = array(
366                'tSelectBCH' => '00001',
367                'ptSearchPdtAdvTable' => 'โค้กซีโร่',
368                'ptSODocNo' => '',
369                'ptSOStaApv' => '',
370                'ptSOStaDoc' => '1',
371                'ptSOVATInOrEx' => '1',
372                'pnSOPageCurrent' => '1',
373              );
374                $oOutput = $this->request(
375                    'POST',
376                    'document/saleorder/cSaleOrder/FSoCSOPdtAdvTblLoadData',
377                    $aParam
378                );
379                $this->assertStringContainsString('Fucntion Success Return View', $oOutput);
380                $this->assertResponseCode(200);
381                // ob_end_flush();
382        }
383
384        
385
386        //7.ลบข้อมูลสินค้า_1_รายการต้องสำเร็จ
387        public function test_SO_ลบข้อมูลสินค้า_1_รายการต้องสำเร็จ(){
388            print " 12.ลบข้อมูลสินค้า_1_รายการต้องสำเร็จ\n";
389            $tSesSessionID = $_SESSION['tSesSessionID'];
390            $ci = &get_instance();
391            $ci->load->database();
392        
393            $aParam = array(
394                'tBchCode' => '00001',
395                'tDocNo' => '',
396                'nSeqNo' => '1',
397                'tPdtCode' => '00148',
398                'tVatInOrEx' => '1',
399                'ohdSesSessionID' => '0000220230323103400',
400                'ohdSOUsrCode' => '00002',
401                'ohdSOLangEdit' => '1',
402                'ohdSesUsrLevel' => 'HQ',
403                'ohdSOSesUsrBchCode' => '',
404              );
405                // print_r($aParam);
406                $oOutput = $this->request(
407                    'POST',
408                    'document/saleorder/cSaleOrder/FSvCSORemovePdtInDTTmp',
409                    $aParam
410                );
411                $this->assertStringContainsString('Success Delete Product', $oOutput);
412                $this->assertResponseCode(200);
413            
414        }
415
416
417
418
419            
420        //9.ลบข้อมูลสินค้า_2_รายการต้องสำเร็จ
421        public function test_SO_ลบข้อมูลสินค้า_2_รายการต้องสำเร็จ(){
422            print " 13.ลบข้อมูลสินค้า_2_รายการต้องสำเร็จ\n";
423            $tSesSessionID = $_SESSION['tSesSessionID'];
424            $ci = &get_instance();
425            $ci->load->database();
426        
427            
428                $aParam = array(
429                    'ptSOBchCode' => '00001',
430                    'ptSODocNo' => '',
431                    'ptSOVatInOrEx' => '1',
432                    'paDataPdtCode' => array(
433                      '' => '00155',
434                      '' => '00157 ',
435                    ),
436                    'paDataSeqNo' => array(
437                      '' => '1',
438                      '' => '2 ',
439                    ),
440                    'ohdSesSessionID' => '0000220230323103400',
441                    'ohdSOUsrCode' => '00002',
442                    'ohdSOLangEdit' => '1',
443                    'ohdSesUsrLevel' => 'HQ',
444                    'ohdSOSesUsrBchCode' => '',
445                  );
446            
447                // print_r($aParam);
448                $oOutput = $this->request(
449                    'POST',
450                    'document/saleorder/cSaleOrder/FSvCSORemovePdtInDTTmpMulti',
451                    $aParam
452                );
453                $this->assertStringContainsString('Success Delete Product', $oOutput);
454                $this->assertResponseCode(200);
455            
456        }
457
458
459
460                    
461        //9.บันทึกเอกสาร กำหนดเงื่อนไขครบถ้วน
462        public function test_SO_บันทึกเอกสาร_กำหนดเงื่อนไขครบถ้วน(){
463            print " 14.บันทึกเอกสารกำหนดเงื่อนไขครบถ้วน\n";
464            $tSesSessionID = $_SESSION['tSesSessionID'];
465            $ci = &get_instance();
466            $ci->load->database();
467        
468            
469                $aParam = array(
470                    'ohdSOPage' => '1',
471                    'ohdSORoute' => 'dcmSOEventAdd',
472                    'ohdSOCheckClearValidate' => '0',
473                    'ohdSOCheckSubmitByButton' => '1',
474                    'ohdSOAutStaEdit' => '0',
475                    'ohdSOPplCodeBch' => '',
476                    'ohdSOPplCodeCst' => '00003',
477                    'ohdSOStaRefund' => '1',
478                    'ohdSOStaDoc' => '1',
479                    'ohdSOStaApv' => '',
480                    'ohdSOStaDelMQ' => '',
481                    'ohdSOStaPrcStk' => '',
482                    'ohdSOStaPaid' => '1',
483                    'ohdSOODecimalShow' => '2',
484                    'ohdSOSesUsrBchCode' => '',
485                    'ohdSOBchCode' => '',
486                    'ohdSODptCode' => '',
487                    'ohdSOUsrCode' => '00002',
488                    'ohdSOPosCode' => '',
489                    'ohdSOShfCode' => '',
490                    'ohdSOCmpRteCode' => 'THB',
491                    'ohdSORteFac' => '1.0000',
492                    'ohdSOApvCodeUsrLogin' => '00002',
493                    'ohdSOLangEdit' => '1',
494                    'ohdSOOptAlwSaveQty' => '0',
495                    'ohdSOOptScanSku' => '',
496                    'ohdSOVatRate' => '7.0000',
497                    'ohdSOCmpRetInOrEx' => '1',
498                    'ohdSesSessionID' => '0000220230323103400',
499                    'ohdSesUsrLevel' => 'HQ',
500                    'ohdSesUsrBchCom' => '',
501                    'ohdSOValidatePdt' => 'กรุณาทำการเลือกสินค้าที่ต้องการทำรายการ',
502                    'ocbSOStaAutoGenCode' => 'on',
503                    'oetSODocNo' => '',
504                    'ohdSOCheckDuplicateCode' => '2',
505                    'oetSODocDate' => '2023-03-23',
506                    'oetSODocTime' => '15:34 PM',
507                    'ohdSOCreateBy' => 'Adasoft',
508                    'oetSOFrmBchCodeOld' => '00001',
509                    'oetSOFrmBchNameOld' => 'AdaSoft00001',
510                    'oetSOFrmBchCode' => '00001',
511                    'oetSOFrmBchName' => 'AdaSoft00001',
512                    'oetSOFrmMerCode' => '',
513                    'oetSOFrmMerName' => '',
514                    'oetSOFrmShpCode' => '',
515                    'oetSOFrmShpName' => '',
516                    'oetSOFrmPosCode' => '',
517                    'oetSOFrmPosName' => '',
518                    'oetSOFrmWahCode' => '00001',
519                    'oetSOFrmWahName' => 'คลังขาย',
520                    'ocmSOFrmSplInfoVatInOrEx' => '1',
521                    'oetSOFrmCstHNNumber' => 'AR0000100044',
522                    'oetSOFrmCstCtzID' => '15013510202',
523                    'oetSOFrmCustomerName' => 'เทปใสมายแคท',
524                    'oetSOFrmCstTel' => '069490904',
525                    'ocmSOFrmSplInfoPaymentType' => '1',
526                    'ocbSOStaAlwPosCalSo' => '1',
527                    'oetSORefPoDoc' => '',
528                    'oetSORefIntDoc' => '',
529                    'oetSORefIntDocDate' => '',
530                    'oetSORefExtDoc' => '',
531                    'oetSORefExtDocDate' => '',
532                    'ocbSOFrmInfoOthStaDocAct' => '1',
533                    'ocmSOFrmInfoOthRef' => '0',
534                    'ocmSOFrmInfoOthDocPrint' => '0',
535                    'ocmSOFrmInfoOthReAddPdt' => '2',
536                    'otaSOFrmInfoOthRmk' => '                                                                            ',
537                    'oetSOFrmCstCode' => 'AR0000100044',
538                    'oetSOFrmCstName' => 'เทปใสมายแคท',
539                    'oetSOFrmFilterPdtHTML' => 'โค้กซีโร่',
540                    'oetSOFrmSearchAndAddPdtHTML' => '',
541                    'oetSOInsertBarcode' => '',
542                    'ohdQty1' => '1.00',
543                    'ohdPrice1' => '150.00',
544                    'ohdSumFCXtdVat' => '0.00',
545                  );
546            
547                // print_r($aParam);
548                $oOutput = $this->request(
549                    'POST',
550                    'document/saleorder/cSaleOrder/FSoCSOAddEventDoc',
551                    $aParam
552                );
553                $this->assertStringContainsString('Success Add Document', $oOutput);
554                $this->assertResponseCode(200);
555            
556        }
557
558        //9.บันทึกเอกสาร กำหนดเงื่อนไขครบถ้วน
559        public function test_SO_บันทึกเอกสาร_กำหนดบางเงื่อนไข(){
560            print " 15.test_SO_บันทึกเอกสาร_กำหนดบางเงื่อนไข\n";
561            $tSesSessionID = $_SESSION['tSesSessionID'];
562            $ci = &get_instance();
563            $ci->load->database();
564        
565            
566                $aParam = array(
567                    'ohdSOPage' => '1',
568                    'ohdSORoute' => 'dcmSOEventAdd',
569                    'ohdSOCheckClearValidate' => '0',
570                    'ohdSOCheckSubmitByButton' => '1',
571                    'ohdSOAutStaEdit' => '0',
572                    'ohdSOPplCodeBch' => '',
573                    'ohdSOPplCodeCst' => '00003',
574                    'ohdSOStaRefund' => '1',
575                    'ohdSOStaDoc' => '1',
576                    'ohdSOStaApv' => '',
577                    'ohdSOStaDelMQ' => '',
578                    'ohdSOStaPrcStk' => '',
579                    'ohdSOStaPaid' => '1',
580                    'ohdSOODecimalShow' => '2',
581                    'ohdSOSesUsrBchCode' => '',
582                    'ohdSOBchCode' => '',
583                    'ohdSODptCode' => '',
584                    'ohdSOUsrCode' => '00002',
585                    'ohdSOPosCode' => '',
586                    'ohdSOShfCode' => '',
587                    'ohdSOCmpRteCode' => 'THB',
588                    'ohdSORteFac' => '1.0000',
589                    'ohdSOApvCodeUsrLogin' => '00002',
590                    'ohdSOLangEdit' => '1',
591                    'ohdSOOptAlwSaveQty' => '0',
592                    'ohdSOOptScanSku' => '',
593                    'ohdSOVatRate' => '7.0000',
594                    'ohdSOCmpRetInOrEx' => '1',
595                    'ohdSesSessionID' => '0000220230323103400',
596                    'ohdSesUsrLevel' => 'HQ',
597                    'ohdSesUsrBchCom' => '',
598                    'ohdSOValidatePdt' => 'กรุณาทำการเลือกสินค้าที่ต้องการทำรายการ',
599                    'ocbSOStaAutoGenCode' => 'on',
600                    'oetSODocNo' => '',
601                    'ohdSOCheckDuplicateCode' => '2',
602                    'oetSODocDate' => '2023-03-23',
603                    'oetSODocTime' => '15:34 PM',
604                    'ohdSOCreateBy' => 'Adasoft',
605                    'oetSOFrmBchCodeOld' => '00001',
606                    'oetSOFrmBchNameOld' => 'AdaSoft00001',
607                    'oetSOFrmBchCode' => '00001',
608                    'oetSOFrmBchName' => 'AdaSoft00001',
609                    'oetSOFrmMerCode' => '',
610                    'oetSOFrmMerName' => '',
611                    'oetSOFrmShpCode' => '',
612                    'oetSOFrmShpName' => '',
613                    'oetSOFrmPosCode' => '',
614                    'oetSOFrmPosName' => '',
615                    'oetSOFrmWahCode' => '00001',
616                    'oetSOFrmWahName' => 'คลังขาย',
617                    'ocmSOFrmSplInfoVatInOrEx' => '1',
618                    'oetSOFrmCstHNNumber' => 'AR0000100044',
619                    'oetSOFrmCstCtzID' => '15013510202',
620                    'oetSOFrmCustomerName' => 'เทปใสมายแคท',
621                    'oetSOFrmCstTel' => '',
622                    'ocmSOFrmSplInfoPaymentType' => '1',
623                    'ocbSOStaAlwPosCalSo' => '1',
624                    'oetSORefPoDoc' => '',
625                    'oetSORefIntDoc' => '',
626                    'oetSORefIntDocDate' => '',
627                    'oetSORefExtDoc' => '',
628                    'oetSORefExtDocDate' => '',
629                    'ocbSOFrmInfoOthStaDocAct' => '1',
630                    'ocmSOFrmInfoOthRef' => '0',
631                    'ocmSOFrmInfoOthDocPrint' => '0',
632                    'ocmSOFrmInfoOthReAddPdt' => '2',
633                    'otaSOFrmInfoOthRmk' => '                                                                            ',
634                    'oetSOFrmCstCode' => 'AR0000100044',
635                    'oetSOFrmCstName' => 'เทปใสมายแคท',
636                    'oetSOFrmFilterPdtHTML' => 'โค้กซีโร่',
637                    'oetSOFrmSearchAndAddPdtHTML' => '',
638                    'oetSOInsertBarcode' => '',
639                    'ohdQty1' => '1.00',
640                    'ohdPrice1' => '150.00',
641                    'ohdSumFCXtdVat' => '0.00',
642                  );
643            
644                // print_r($aParam);
645                $oOutput = $this->request(
646                    'POST',
647                    'document/saleorder/cSaleOrder/FSoCSOAddEventDoc',
648                    $aParam
649                );
650                $this->assertStringContainsString('Success Add Document', $oOutput);
651                $this->assertResponseCode(200);
652            
653        }
654
655
656        //9.บันทึกเอกสาร กำหนดเงื่อนไขครบถ้วน
657        public function test_SO_บันทึกเอกสาร_กรอกข้อมูลที่ยาวเกินขนาดของฟิวด์(){
658            print " 16.test_SO_บันทึกเอกสาร_กรอกข้อมูลที่ยาวเกินขนาดของฟิวด์\n";
659            $tSesSessionID = $_SESSION['tSesSessionID'];
660            $ci = &get_instance();
661            $ci->load->database();
662        
663            
664                $aParam = array(
665                    'ohdSOPage' => '1',
666                    'ohdSORoute' => 'dcmSOEventAdd',
667                    'ohdSOCheckClearValidate' => '0',
668                    'ohdSOCheckSubmitByButton' => '1',
669                    'ohdSOAutStaEdit' => '0',
670                    'ohdSOPplCodeBch' => '',
671                    'ohdSOPplCodeCst' => '00003',
672                    'ohdSOStaRefund' => '1',
673                    'ohdSOStaDoc' => '1',
674                    'ohdSOStaApv' => '',
675                    'ohdSOStaDelMQ' => '',
676                    'ohdSOStaPrcStk' => '',
677                    'ohdSOStaPaid' => '1',
678                    'ohdSOODecimalShow' => '2',
679                    'ohdSOSesUsrBchCode' => '',
680                    'ohdSOBchCode' => '',
681                    'ohdSODptCode' => '',
682                    'ohdSOUsrCode' => '00002',
683                    'ohdSOPosCode' => '',
684                    'ohdSOShfCode' => '',
685                    'ohdSOCmpRteCode' => 'THB',
686                    'ohdSORteFac' => '1.0000',
687                    'ohdSOApvCodeUsrLogin' => '00002',
688                    'ohdSOLangEdit' => '1',
689                    'ohdSOOptAlwSaveQty' => '0',
690                    'ohdSOOptScanSku' => '',
691                    'ohdSOVatRate' => '7.0000',
692                    'ohdSOCmpRetInOrEx' => '1',
693                    'ohdSesSessionID' => '0000220230323103400',
694                    'ohdSesUsrLevel' => 'HQ',
695                    'ohdSesUsrBchCom' => '',
696                    'ohdSOValidatePdt' => 'กรุณาทำการเลือกสินค้าที่ต้องการทำรายการ',
697                    'ocbSOStaAutoGenCode' => 'on',
698                    'oetSODocNo' => '',
699                    'ohdSOCheckDuplicateCode' => '2',
700                    'oetSODocDate' => '2023-03-23',
701                    'oetSODocTime' => '15:34 PM',
702                    'ohdSOCreateBy' => 'Adasoft',
703                    'oetSOFrmBchCodeOld' => '00001',
704                    'oetSOFrmBchNameOld' => 'AdaSoft00001',
705                    'oetSOFrmBchCode' => '00001',
706                    'oetSOFrmBchName' => 'AdaSoft00001',
707                    'oetSOFrmMerCode' => '',
708                    'oetSOFrmMerName' => '',
709                    'oetSOFrmShpCode' => '',
710                    'oetSOFrmShpName' => '',
711                    'oetSOFrmPosCode' => '',
712                    'oetSOFrmPosName' => '',
713                    'oetSOFrmWahCode' => '00001',
714                    'oetSOFrmWahName' => 'คลังขาย',
715                    'ocmSOFrmSplInfoVatInOrEx' => '1',
716                    'oetSOFrmCstHNNumber' => 'AR0000100044',
717                    'oetSOFrmCstCtzID' => '15013510202',
718                    'oetSOFrmCustomerName' => 'เทปใสมายแคทเทปใสมายแคทเทปใสมายแคทเทปใสมายแคทเทปใสมายแคทเทปใสมายแคทเทปใสมายแคทเทปใสมายแคทเทปใสมายแคทเทปใสมายแคทเทปใสมายแคทเทปใสมายแคทเทปใสมายแคทเทปใสมายแคทเทปใสมายแคทเทปใสมายแคทเทปใสมายแคทเทปใสมายแคทเทปใสมายแคทเทปใสมายแคทเทปใสมายแคทเทปใสมายแคทเทปใสมายแคทเทปใสมายแคทเทปใสมายแคทเทปใสมายแคทเทปใสมายแคทเทปใสมายแคท',
719                    'oetSOFrmCstTel' => '',
720                    'ocmSOFrmSplInfoPaymentType' => '1',
721                    'ocbSOStaAlwPosCalSo' => '1',
722                    'oetSORefPoDoc' => '',
723                    'oetSORefIntDoc' => '',
724                    'oetSORefIntDocDate' => '',
725                    'oetSORefExtDoc' => '',
726                    'oetSORefExtDocDate' => '',
727                    'ocbSOFrmInfoOthStaDocAct' => '1',
728                    'ocmSOFrmInfoOthRef' => '0',
729                    'ocmSOFrmInfoOthDocPrint' => '0',
730                    'ocmSOFrmInfoOthReAddPdt' => '2',
731                    'otaSOFrmInfoOthRmk' => '                                                                            ',
732                    'oetSOFrmCstCode' => 'AR0000100044',
733                    'oetSOFrmCstName' => 'เทปใสมายแคท',
734                    'oetSOFrmFilterPdtHTML' => 'โค้กซีโร่',
735                    'oetSOFrmSearchAndAddPdtHTML' => '',
736                    'oetSOInsertBarcode' => '',
737                    'ohdQty1' => '1.00',
738                    'ohdPrice1' => '150.00',
739                    'ohdSumFCXtdVat' => '0.00',
740                  );
741            
742                //validator
743                $afield = [
744                    'ohdSOPage' =>'max:1',
745                    'ohdSORoute' => 'max:300',
746                    'ohdSOCheckClearValidate' =>'max:1',
747                    'ohdSOCheckSubmitByButton' =>'max:1',
748                    'ohdSOAutStaEdit' => 'max:1',
749                    'ohdSOPplCodeBch' => 'max:5',
750                    'ohdSOPplCodeCst' => 'max:5',
751                    'ohdSOStaRefund' => 'max:1',
752                    'ohdSOStaDoc' => 'max:1',
753                    'ohdSOStaApv' => '',
754                    'ohdSOStaDelMQ' => '',
755                    'ohdSOStaPrcStk' => '',
756                    'ohdSOStaPaid' => 'max:1',
757                    'ohdSOODecimalShow' => 'max:1',
758                    'ohdSOSesUsrBchCode' => '',
759                    'ohdSOBchCode' => '',
760                    'ohdSODptCode' => '',
761                    'ohdSOUsrCode' => 'max:20',
762                    'ohdSOPosCode' => '',
763                    'ohdSOShfCode' => '',
764                    'ohdSOCmpRteCode' => 'THB',
765                    'ohdSORteFac' => '1.0000',
766                    'ohdSOApvCodeUsrLogin' => 'max:20',
767                    'ohdSOLangEdit' => 'max:1',
768                    'ohdSOOptAlwSaveQty' => '0',
769                    'ohdSOOptScanSku' => '',
770                    'ohdSOVatRate' => '7.0000',
771                    'ohdSOCmpRetInOrEx' => 'max:1',
772                    'ohdSesSessionID' => 'max:200',
773                    'ohdSesUsrLevel' => 'max:5',
774                    'ohdSesUsrBchCom' => '',
775                    'ohdSOValidatePdt' => 'max:200',
776                    'ocbSOStaAutoGenCode' => 'max:5',
777                    'oetSODocNo' => 'max:20',
778                    'ohdSOCheckDuplicateCode' => 'max:1',
779                    'oetSODocDate' => 'max:12',
780                    'oetSODocTime' => 'max:8',
781                    'ohdSOCreateBy' => 'max:200',
782                    'oetSOFrmBchCodeOld' => 'max:5',
783                    'oetSOFrmBchNameOld' => 'max:200',
784                    'oetSOFrmBchCode' => 'max:5',
785                    'oetSOFrmBchName' => 'max:200',
786                    'oetSOFrmMerCode' => 'max:5',
787                    'oetSOFrmMerName' => 'max:200',
788                    'oetSOFrmShpCode' => 'max:5',
789                    'oetSOFrmShpName' => 'max:200',
790                    'oetSOFrmPosCode' =>'max:5',
791                    'oetSOFrmPosName' => 'max:200',
792                    'oetSOFrmWahCode' => 'max:5',
793                    'oetSOFrmWahName' => 'max:150',
794                    'ocmSOFrmSplInfoVatInOrEx' => 'max:1',
795                    'oetSOFrmCstHNNumber' => 'max:30',
796                    'oetSOFrmCstCtzID' => 'max:11',
797                    'oetSOFrmCustomerName' => 'max:200',
798                    'oetSOFrmCstTel' => 'max:20',
799                    'ocmSOFrmSplInfoPaymentType' => 'max:1',
800                    'ocbSOStaAlwPosCalSo' => 'max:1',
801                    'oetSORefPoDoc' => '',
802                    'oetSORefIntDoc' => '',
803                    'oetSORefIntDocDate' => '',
804                    'oetSORefExtDoc' => '',
805                    'oetSORefExtDocDate' => '',
806                    'ocbSOFrmInfoOthStaDocAct' => 'max:1',
807                    'ocmSOFrmInfoOthRef' => 'max:1',
808                    'ocmSOFrmInfoOthDocPrint' => 'max:1',
809                    'ocmSOFrmInfoOthReAddPdt' => 'max:1',
810                    'otaSOFrmInfoOthRmk' => '                                                                            ',
811                    'oetSOFrmCstCode' => 'max:20',
812                    'oetSOFrmCstName' => 'max:200',
813                    'oetSOFrmFilterPdtHTML' => 'max:200',
814                    'oetSOFrmSearchAndAddPdtHTML' => '',
815                    'oetSOInsertBarcode' => '',
816                    'ohdQty1' => '',
817                    'ohdPrice1' => '',
818                    'ohdSumFCXtdVat' => '',
819
820                ];
821                $aResult = json_encode(validate($aParam,$afield));
822                $this->assertStringContainsString('The oetSOFrmCustomerName must have at most 200 characters', $aResult);
823            
824        }
825
826
827
828                //9.บันทึกเอกสาร กำหนดเงื่อนไขครบถ้วน
829                public function test_SO_บันทึกเอกสาร_กรอกข้อมูลที่ผิดประเภทของฟิวด์(){
830                    print " 17.test_SO_บันทึกเอกสาร_กรอกข้อมูลที่ผิดประเภทของฟิวด์\n";
831                    $tSesSessionID = $_SESSION['tSesSessionID'];
832                    $ci = &get_instance();
833                    $ci->load->database();
834                
835                    
836                        $aParam = array(
837                            'ohdSOPage' => '1',
838                            'ohdSORoute' => 'dcmSOEventAdd',
839                            'ohdSOCheckClearValidate' => '0',
840                            'ohdSOCheckSubmitByButton' => '1',
841                            'ohdSOAutStaEdit' => '0',
842                            'ohdSOPplCodeBch' => '',
843                            'ohdSOPplCodeCst' => '00003',
844                            'ohdSOStaRefund' => '1',
845                            'ohdSOStaDoc' => '1',
846                            'ohdSOStaApv' => '',
847                            'ohdSOStaDelMQ' => '',
848                            'ohdSOStaPrcStk' => '',
849                            'ohdSOStaPaid' => '1',
850                            'ohdSOODecimalShow' => '2',
851                            'ohdSOSesUsrBchCode' => '',
852                            'ohdSOBchCode' => '',
853                            'ohdSODptCode' => '',
854                            'ohdSOUsrCode' => '00002',
855                            'ohdSOPosCode' => '',
856                            'ohdSOShfCode' => '',
857                            'ohdSOCmpRteCode' => 'THB',
858                            'ohdSORteFac' => '1.0000',
859                            'ohdSOApvCodeUsrLogin' => '00002',
860                            'ohdSOLangEdit' => '1',
861                            'ohdSOOptAlwSaveQty' => '0',
862                            'ohdSOOptScanSku' => '',
863                            'ohdSOVatRate' => '7.0000',
864                            'ohdSOCmpRetInOrEx' => '1',
865                            'ohdSesSessionID' => '0000220230323103400',
866                            'ohdSesUsrLevel' => 'HQ',
867                            'ohdSesUsrBchCom' => '',
868                            'ohdSOValidatePdt' => 'กรุณาทำการเลือกสินค้าที่ต้องการทำรายการ',
869                            'ocbSOStaAutoGenCode' => 'on',
870                            'oetSODocNo' => '',
871                            'ohdSOCheckDuplicateCode' => '2',
872                            'oetSODocDate' => '2023-03-23',
873                            'oetSODocTime' => '15:34 PM',
874                            'ohdSOCreateBy' => 'Adasoft',
875                            'oetSOFrmBchCodeOld' => '00001',
876                            'oetSOFrmBchNameOld' => 'AdaSoft00001',
877                            'oetSOFrmBchCode' => '00001',
878                            'oetSOFrmBchName' => 'AdaSoft00001',
879                            'oetSOFrmMerCode' => '',
880                            'oetSOFrmMerName' => '',
881                            'oetSOFrmShpCode' => '',
882                            'oetSOFrmShpName' => '',
883                            'oetSOFrmPosCode' => '',
884                            'oetSOFrmPosName' => '',
885                            'oetSOFrmWahCode' => '00001',
886                            'oetSOFrmWahName' => 'คลังขาย',
887                            'ocmSOFrmSplInfoVatInOrEx' => '1',
888                            'oetSOFrmCstHNNumber' => 'AR0000100044',
889                            'oetSOFrmCstCtzID' => '15013510202',
890                            'oetSOFrmCustomerName' => 'เทปใสมายแคทเทปใสมายแคทเ',
891                            'oetSOFrmCstTel' => '',
892                            'ocmSOFrmSplInfoPaymentType' => '1',
893                            'ocbSOStaAlwPosCalSo' => '1',
894                            'oetSORefPoDoc' => '',
895                            'oetSORefIntDoc' => '',
896                            'oetSORefIntDocDate' => '',
897                            'oetSORefExtDoc' => '',
898                            'oetSORefExtDocDate' => '',
899                            'ocbSOFrmInfoOthStaDocAct' => '1',
900                            'ocmSOFrmInfoOthRef' => '0',
901                            'ocmSOFrmInfoOthDocPrint' => '0',
902                            'ocmSOFrmInfoOthReAddPdt' => '2',
903                            'otaSOFrmInfoOthRmk' => '',
904                            'oetSOFrmCstCode' => 'AR0000100044',
905                            'oetSOFrmCstName' => 'เทปใสมายแคท',
906                            'oetSOFrmFilterPdtHTML' => 'โค้กซีโร่',
907                            'oetSOFrmSearchAndAddPdtHTML' => '',
908                            'oetSOInsertBarcode' => '',
909                            'ohdQty1' =>  array('testfailr'),
910                            'ohdPrice1' => '150.00',
911                            'ohdSumFCXtdVat' => '0.00',
912                          );
913                    
914                        //validator
915                        $afield = [
916                            'ohdSOPage' =>'string',
917                            'ohdSORoute' => 'string',
918                            'ohdSOCheckClearValidate' =>'string',
919                            'ohdSOCheckSubmitByButton' =>'string',
920                            'ohdSOAutStaEdit' => 'string',
921                            'ohdSOPplCodeBch' => 'string',
922                            'ohdSOPplCodeCst' => 'string',
923                            'ohdSOStaRefund' => 'string',
924                            'ohdSOStaDoc' => 'string',
925                            'ohdSOStaApv' => 'string',
926                            'ohdSOStaDelMQ' => 'string',
927                            'ohdSOStaPrcStk' => 'string',
928                            'ohdSOStaPaid' => 'string',
929                            'ohdSOODecimalShow' => 'string',
930                            'ohdSOSesUsrBchCode' => 'string',
931                            'ohdSOBchCode' => 'string',
932                            'ohdSODptCode' => 'string',
933                            'ohdSOUsrCode' => 'string',
934                            'ohdSOPosCode' => 'string',
935                            'ohdSOShfCode' => 'string',
936                            'ohdSOCmpRteCode' => 'string',
937                            'ohdSORteFac' => 'string',
938                            'ohdSOApvCodeUsrLogin' => 'string',
939                            'ohdSOLangEdit' => 'string',
940                            'ohdSOOptAlwSaveQty' => 'string',
941                            'ohdSOOptScanSku' => 'string',
942                            'ohdSOVatRate' => 'string',
943                            'ohdSOCmpRetInOrEx' => 'string',
944                            'ohdSesSessionID' => 'string',
945                            'ohdSesUsrLevel' => 'string',
946                            'ohdSesUsrBchCom' => 'string',
947                            'ohdSOValidatePdt' => 'string',
948                            'ocbSOStaAutoGenCode' => 'string',
949                            'oetSODocNo' => 'string',
950                            'ohdSOCheckDuplicateCode' => 'string',
951                            'oetSODocDate' => 'string',
952                            'oetSODocTime' => 'string',
953                            'ohdSOCreateBy' => 'string',
954                            'oetSOFrmBchCodeOld' => 'string',
955                            'oetSOFrmBchNameOld' => 'string',
956                            'oetSOFrmBchCode' => 'string',
957                            'oetSOFrmBchName' => 'string',
958                            'oetSOFrmMerCode' => 'string',
959                            'oetSOFrmMerName' => 'string',
960                            'oetSOFrmShpCode' => 'string',
961                            'oetSOFrmShpName' => 'string',
962                            'oetSOFrmPosCode' =>'string',
963                            'oetSOFrmPosName' => 'string',
964                            'oetSOFrmWahCode' => 'string',
965                            'oetSOFrmWahName' => 'string',
966                            'ocmSOFrmSplInfoVatInOrEx' => 'string',
967                            'oetSOFrmCstHNNumber' => 'string',
968                            'oetSOFrmCstCtzID' => 'string',
969                            'oetSOFrmCustomerName' => 'string',
970                            'oetSOFrmCstTel' => 'string',
971                            'ocmSOFrmSplInfoPaymentType' => 'string',
972                            'ocbSOStaAlwPosCalSo' => 'string',
973                            'oetSORefPoDoc' => 'string',
974                            'oetSORefIntDoc' => 'string',
975                            'oetSORefIntDocDate' => 'string',
976                            'oetSORefExtDoc' => 'string',
977                            'oetSORefExtDocDate' => 'string',
978                            'ocbSOFrmInfoOthStaDocAct' => 'string',
979                            'ocmSOFrmInfoOthRef' => 'string',
980                            'ocmSOFrmInfoOthDocPrint' => 'string',
981                            'ocmSOFrmInfoOthReAddPdt' => 'string',
982                            'otaSOFrmInfoOthRmk' => 'string',
983                            'oetSOFrmCstCode' => 'string',
984                            'oetSOFrmCstName' => 'string',
985                            'oetSOFrmFilterPdtHTML' => 'string',
986                            'oetSOFrmSearchAndAddPdtHTML' => 'string',
987                            'oetSOInsertBarcode' => 'string',
988                            'ohdQty1' => 'integer',
989                            'ohdPrice1' => 'integer',
990                            'ohdSumFCXtdVat' => 'integer',
991        
992                        ];
993                        $aResult = json_encode(validate_type($aParam,$afield));
994                        $this->assertStringContainsString('Error type varible', $aResult);
995                    
996                }
997
998
999
1000    //9.ลบข้อมูลสินค้า_2_รายการต้องสำเร็จ
1001        public function test_SO_โหลดข้อมูลหน้าจอแก้ไขเอกสาร(){
1002            print " 18.โหลดข้อมูลหน้าจอแก้ไขเอกสาร\n";
1003            $tSesSessionID = $_SESSION['tSesSessionID'];
1004            $ci = &get_instance();
1005            $ci->load->database();
1006        
1007            
1008                $aParam = array(
1009                    'ptSODocNo' => 'SO0000123000002'
1010                  );
1011            
1012                // print_r($aParam);
1013                $oOutput = $this->request(
1014                    'POST',
1015                    'document/saleorder/cSaleOrder/FSoCSOEditPage',
1016                    $aParam
1017                );
1018                $this->assertStringContainsString('Success', $oOutput);
1019                $this->assertResponseCode(200);
1020            
1021        }
1022        
1023
1024        
1025    //9.ลบข้อมูลสินค้า_2_รายการต้องสำเร็จ
1026    public function test_SO_ยกเลิกเอกสาร(){
1027        print " 19.ยกเลิกเอกสาร\n";
1028        $tSesSessionID = $_SESSION['tSesSessionID'];
1029        $ci = &get_instance();
1030        $ci->load->database();
1031    
1032        
1033            $aParam = array(
1034                'ptSODocNo' => 'SO0000123000002'
1035              );
1036        
1037            // print_r($aParam);
1038            $oOutput = $this->request(
1039                'POST',
1040                'document/saleorder/cSaleOrder/FSvCSOCancelDocument',
1041                $aParam
1042            );
1043            $this->assertStringContainsString('Update Status Document Cancel Success', $oOutput);
1044            $this->assertResponseCode(200);
1045        
1046    }
1047
1048
1049        //9.ลบข้อมูลสินค้า_2_รายการต้องสำเร็จ
1050        public function test_SO_อนุมัติเอกสาร(){
1051            print " 20.อนุมัติเอกสาร\n";
1052            $tSesSessionID = $_SESSION['tSesSessionID'];
1053            $ci = &get_instance();
1054            $ci->load->database();
1055        
1056            
1057                $aParam = array(
1058                    'ptSODocNo' => 'SO0000123000027',
1059                    'ptSOBchCode' => '00001',
1060                    'ptSOStaApv' => '',
1061                    'ptSOSplPaymentType' => '1',
1062                  );
1063            
1064                // print_r($aParam);
1065                $oOutput = $this->request(
1066                    'POST',
1067                    'document/saleorder/cSaleOrder/FSvCSOApproveDocument',
1068                    $aParam
1069                );
1070                $this->assertStringContainsString('Success Document Approve', $oOutput);
1071                $this->assertResponseCode(200);
1072            
1073        }
1074
1075
1076
1077    //9.ลบข้อมูลสินค้า_2_รายการต้องสำเร็จ
1078    public function test_SO_ลบเอกสาร_1_รายการ(){
1079        print " 21.ลบเอกสาร_1_รายการ\n";
1080        $tSesSessionID = $_SESSION['tSesSessionID'];
1081        $ci = &get_instance();
1082        $ci->load->database();
1083    
1084        
1085            $aParam = array(
1086                'tDataDocNo' => 'SO0000123000029',
1087                );
1088        
1089            // print_r($aParam);
1090            $oOutput = $this->request(
1091                'POST',
1092                'document/saleorder/cSaleOrder/FSoCSODeleteEventDoc',
1093                $aParam
1094            );
1095            $this->assertStringContainsString('Success', $oOutput);
1096            $this->assertResponseCode(200);
1097        
1098    }
1099
1100        //9.ลบข้อมูลสินค้า_2_รายการต้องสำเร็จ
1101        public function test_SO_ลบเอกสาร_2_รายการ(){
1102            print " 22.ลบเอกสาร_2_รายการ\n";
1103            $tSesSessionID = $_SESSION['tSesSessionID'];
1104            $ci = &get_instance();
1105            $ci->load->database();
1106        
1107            
1108                $aParam = array(
1109                    'tDataDocNo' => array(
1110                      0 => 'SO0000123000028',
1111                      1 => 'SO0000123000026 '
1112                    )
1113                  );
1114                // print_r($aParam);
1115                $oOutput = $this->request(
1116                    'POST',
1117                    'document/saleorder/cSaleOrder/FSoCSODeleteEventDoc',
1118                    $aParam
1119                );
1120                $this->assertStringContainsString('Success', $oOutput);
1121                $this->assertResponseCode(200);
1122            
1123        }
1124}