RCV1000.php
24.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
<?PHP
//*****************************************************************************
//* プログラム名:請求・入金管理
//* プログラムID:RCV1000.php
//* 機能 :請求管理画面
//*****************************************************************************
header("Content-type: text/html; charset=EUC-JP");
include("./inc/session_start.inc");
include("./inc/SessionChk.inc");
include("./inc/dbcon.inc");
include('./inc/smarty.conf');
include("./inc/const.inc");
include("./inc/pagetitle.inc");
include("./inc/pagefooter.inc");
//モード 1:売上 2:外注
$uriageMode = $_REQUEST["uriageMode"];
if($uriageMode != "2"){
$uriageMode = 1;
}
if($uriageMode == "1"){
$pageTTL = "売上";
$moneyType = "入金";
}else if($uriageMode == "2"){
$pageTTL = "外注費";
$moneyType = "支払";
}
//ソート情報
$srt1 = $_REQUEST["srt1"]; //1:部門 2:業務名 3:期間(開始) 4:受注額
$srt2 = $_REQUEST["srt2"]; //1:ASC 2:DESC
if($srt1 == ""){
$srt1 = "1";
$srt2 = "1";
}
$nameArr = "";
$strORDER = getOrder($srt1,$srt2,$nameArr);
//*** 請求・入金初期情報 ***//
$strSQL = "SELECT * FROM rcv_kanri WHERE kanri_id=1";
$objRec = pg_exec($strSQL);
if($objRec==false){
echo("SQL実行に失敗しました(SELECT)");
exit;
}
if(pg_numrows($objRec)>0){
$objData = pg_fetch_object($objRec, 0);
$RCV_MODE = $objData->kanri_data;
}else{
$RCV_MODE = "0";
}
//*** 表示モード ***//
switch ($RCV_MODE) {
case "0":
$cboMode = $_REQUEST["cboMode"];
if ($cboMode==""){
$cboMode = "1";
}
$ModeData = '<OPTION value="1" ';
if ($cboMode=="1"){
$ModeData.="selected";
}
$ModeData.='>予定日</OPTION>';
$ModeData.='<OPTION value="2" ';
if ($cboMode=="2"){
$ModeData.="selected";
}
$ModeData.='>適用日</OPTION>';
break;
case "1":
$cboMode = $_REQUEST["cboMode"];
if ($cboMode==""){
$cboMode = "1";
}
$ModeData = '<OPTION value="1" ';
if ($cboMode=="1"){
$ModeData.="selected";
}
$ModeData.='>予定日</OPTION>';
break;
case "2":
$cboMode = $_REQUEST["cboMode"];
if ($cboMode==""){
$cboMode = "2";
}
$ModeData.='<OPTION value="2" ';
if ($cboMode=="2"){
$ModeData.="selected";
}
$ModeData.='>適用日</OPTION>';
break;
}
//*** 基本情報 ***//
$strSQL = "SELECT * FROM start_tbl";
$objRec = pg_exec($strSQL);
if($objRec==false){
echo("SQL実行に失敗しました(SELECT)");
exit;
}
if(pg_numrows($objRec)>0){
$objData = pg_fetch_object($objRec, 0);
$start_unit = $objData->start_unit;
}else{
$start_unit = "0";
}
switch ($start_unit) {
case "0":
$Money_Tani = "円";
break;
case "1":
$Money_Tani = "千円";
break;
case "2":
$Money_Tani = "万円";
break;
}
//*** 拠点情報 ***//
//* 閲覧可能拠点 *//
$strSQL = "SELECT * FROM user_area WHERE user_seq = ".$PHP_USER_SEQ." ";
$objRec = pg_exec($strSQL);
if($objRec==false){
echo("SQL実行に失敗しました(SELECT)");
exit;
}
$User_Area[0] = "";
for ($intCnt = 0; $intCnt < pg_numrows($objRec); $intCnt++) {
$objData = pg_fetch_object($objRec, $intCnt);
$User_Area[$intCnt] = $objData->area_id;
}
$cboArea = $_REQUEST["cboArea"];
$AreaData = '<OPTION value="" ';
if ($cboArea==""){
$AreaData.="selected";
}
$AreaData.='>全部門</OPTION>';
if ($User_Area[0]!=""){
$strSQL = "SELECT * FROM bumon_tbl WHERE ";
for ($intI = 0; $intI < count($User_Area); $intI++) {
if ($intI!="0"){
$strSQL .= " OR ";
}
$strSQL .= " bumon_seq = ".$User_Area[$intI];
}
$strSQL .= " ORDER BY disp_rank";
$objRec = pg_exec($strSQL);
if($objRec==false){
echo("SQL実行に失敗しました(SELECT)");
exit;
}
for ($intCnt = 0; $intCnt < pg_numrows($objRec); $intCnt++) {
$objData = pg_fetch_object($objRec, $intCnt);
$AreaData .= '<OPTION value="'.$objData->bumon_seq.'" ';
if ($cboArea==$objData->bumon_seq){
$AreaData.="selected";
}
$AreaData .='>'.$objData->bumon_name.'</OPTION>';
}
}
//*** 業務情報 ***//
$cboGyoumu = $_REQUEST["cboGyoumu"];
$GyoumuData = '<OPTION value="" ';
if ($cboGyoumu==""){
$GyoumuData.="selected";
}
$GyoumuData.='>全業務</OPTION>';
$strSQL = "SELECT * FROM mst_gyoumu ORDER BY disp_rank";
$objRec = pg_exec($strSQL);
if($objRec==false){
echo("SQL実行に失敗しました(SELECT)");
exit;
}
for ($intCnt = 0; $intCnt < pg_numrows($objRec); $intCnt++) {
$objData = pg_fetch_object($objRec, $intCnt);
$GyoumuData .= '<OPTION value="'.$objData->gyoumu_id.'" ';
if ($cboGyoumu==$objData->gyoumu_id){
$GyoumuData.="selected";
}
$GyoumuData .='>'.$objData->gyoumu_name.'</OPTION>';
}
//*** 期間区分 ***//
$cboBunrui = $_REQUEST["cboBunrui"];
$BunruiData = '<OPTION value="" ';
if ($cboBunrui==""){
$BunruiData.="selected";
}
$BunruiData.='>全期間</OPTION>';
$strSQL = "SELECT * FROM bunrui_tbl ORDER BY disp_rank";
$objRec = pg_exec($strSQL);
if($objRec==false){
echo("SQL実行に失敗しました(SELECT)");
exit;
}
for ($intCnt = 0; $intCnt < pg_numrows($objRec); $intCnt++) {
$objData = pg_fetch_object($objRec, $intCnt);
$BunruiData .= '<OPTION value="'.$objData->bunrui_seq.'" ';
if ($cboBunrui==$objData->bunrui_seq){
$BunruiData.="selected";
}
$BunruiData .='>'.$objData->bunrui_name.'</OPTION>';
}
//*** 日付 ***//
$Kijyun_Year = $_REQUEST["Kijyun_Year"];
$Kijyun_Month = $_REQUEST["Kijyun_Month"];
//*** 年度データ郡 ***//
//*** 請求・入金初期情報 ***//
$strSQL = "SELECT * FROM rcv_kanri WHERE kanri_id=2";
$objRec = pg_exec($strSQL);
if($objRec==false){
echo("SQL実行に失敗しました(SELECT)");
exit;
}
if(pg_numrows($objRec)>0){
$objData = pg_fetch_object($objRec, 0);
$start_month = $objData->kanri_data;
}else{
$start_month = "4";
}
if ($start_month > date("n")){
$To_NYear = (int)date("Y")-1;
}else{
$To_NYear = date("Y");
}
$To_NMonth = $start_month;
if ($Kijyun_Year==""){
if ($start_month > date("n")){
$Kijyun_Year = (int)date("Y")-1;
}else{
$Kijyun_Year = date("Y");
}
}
if ($Kijyun_Month==""){
$Kijyun_Month = $start_month;
}
$Bf_Year = date("Y", mktime(0,0,0,$Kijyun_Month-1,"01",$Kijyun_Year));
$Bf_Month = date("m", mktime(0,0,0,$Kijyun_Month-1,"01",$Kijyun_Year));
$To_Year = date("Y");
$To_Month = date("m");
$Af_Year = date("Y", mktime(0,0,0,$Kijyun_Month+1,"01",$Kijyun_Year));
$Af_Month = date("m", mktime(0,0,0,$Kijyun_Month+1,"01",$Kijyun_Year));
for ($intCnt = 0; $intCnt < 12; $intCnt++) {
$DateTitle[$intCnt] = date("Y/m", mktime(0,0,0,$Kijyun_Month+$intCnt,"01",$Kijyun_Year));
$DateTitleDp[$intCnt] = substr(date("Y/m", mktime(0,0,0,$Kijyun_Month+$intCnt,"01",$Kijyun_Year)),2);
$MaxMoney1[$intCnt] = "";
$MaxMoney2[$intCnt] = "";
}
$DateToday = substr(date("Y/m"),2);
//*** 請求情報(該当期間の業者) ***//
$strSQL = "SELECT";
$strSQL .= " rcv_area_id , ";
$strSQL .= " rcv_gyoumu_id , ";
$strSQL .= " bumon_name , ";
$strSQL .= " gyoumu_name , ";
$strSQL .= " gyoumu_money , ";
$strSQL .= " gyoumu_st_term, ";
$strSQL .= " gyoumu_ed_term ";
$strSQL .= "FROM ";
$strSQL .= " rcv_tbl ,";
$strSQL .= " bumon_tbl, ";
$strSQL .= " mst_gyoumu ";
$strSQL .= "WHERE ";
//** 条件 **//
$strSQL .= " rcv_tbl.rcv_seikyukbn = ".$uriageMode." AND ";
//* 業務 *//
$strSQL .= " rcv_tbl.rcv_gyoumu_id = mst_gyoumu.gyoumu_id AND ";
//* 部門 *//
$strSQL .= " rcv_tbl.rcv_area_id = bumon_tbl.bumon_seq AND ";
if ($User_Area[0]!=""){
if ($cboArea!=""){
$strSQL .= " rcv_area_id = ".$cboArea." AND ";
}else{
$strSQL .= " ( ";
for ($intI = 0; $intI < count($User_Area); $intI++) {
if ($intI!="0"){
$strSQL .= " OR ";
}
$strSQL .= " rcv_area_id = ".$User_Area[$intI];
}
$strSQL .= " ) AND ";
}
}else{
if ($cboArea!=""){
$strSQL .= " rcv_area_id = ".$cboArea." AND ";
}else{
$strSQL .= " rcv_area_id = 0 AND ";
}
}
//* 業務 *//
if ($cboGyoumu!=""){
$strSQL .= " rcv_tbl.rcv_gyoumu_id = ".$cboGyoumu." AND ";
}
//* 日付範囲 *//
if ($cboBunrui==""){
switch ($cboMode) {
case "1":
$strSQL .= " seikyu_kigen >='".$DateTitle[0]."/01' AND ";
$strSQL .= " seikyu_kigen <='".$DateTitle[11]."/99' ";
break;
case "2":
$strSQL .= " (";
$strSQL .= " (";
$strSQL .= " nyukin_date >='".$DateTitle[0]."/01' AND ";
$strSQL .= " nyukin_date <='".$DateTitle[11]."/99' ";
$strSQL .= " )";
$strSQL .= " OR ";
$strSQL .= " (";
$strSQL .= " nyukin_date = '' AND ";
$strSQL .= " seikyu_kigen >='".$DateTitle[0]."/01' AND ";
$strSQL .= " seikyu_kigen <='".$DateTitle[11]."/99' ";
$strSQL .= " ) ";
$strSQL .= " )";
break;
}
}else{
$strWhere = "";
for ($intJ = 0; $intJ < count($DateTitle); $intJ++) {
if ($strWhere!=""){
$strWhere .= " OR ";
}
$strWhere .= DateGet($cboBunrui,$cboMode,$DateTitle[$intJ]);
}
$strSQL .= " (".$strWhere.")";
}
$strSQL .= "GROUP BY ";
$strSQL .= " rcv_area_id , ";
$strSQL .= " bumon_name , ";
$strSQL .= " rcv_gyoumu_id , ";
$strSQL .= " gyoumu_name , ";
$strSQL .= " gyoumu_money , ";
$strSQL .= " gyoumu_st_term , ";
$strSQL .= " gyoumu_ed_term , ";
$strSQL .= " bumon_tbl.disp_rank , ";
$strSQL .= " mst_gyoumu.disp_rank ";
$strSQL .= "ORDER BY ";
//$strSQL .= " bumon_tbl.disp_rank ASC , ";
//$strSQL .= " mst_gyoumu.disp_rank ASC ";
$strSQL .= $strORDER;
$objRec = pg_exec($strSQL);
if($objRec==false){
echo("SQL実行に失敗しました(SELECT)");
exit;
}
for ($intI = 0; $intI < pg_numrows($objRec); $intI++) {
$objData = pg_fetch_object($objRec, $intI);
$area_id[$intI] = $objData->rcv_area_id;
$area_name[$intI] = $objData->bumon_name;
$gyoumu_id[$intI] = $objData->rcv_gyoumu_id;
$gyoumu_name[$intI] = $objData->gyoumu_name;
if ($objData->gyoumu_money!=""){
$gyoumu_money[$intI] = number_format($objData->gyoumu_money);
}else{
$gyoumu_money[$intI] = $objData->gyoumu_money;
}
$gyoumu_st_term[$intI] = substr($objData->gyoumu_st_term,2);
$gyoumu_ed_term[$intI] = substr($objData->gyoumu_ed_term,2);
for ($intK = 0; $intK < count($DateTitle); $intK++) {
//*** 請求情報(該当期間の請求金額) ***//
$strSQL = "SELECT";
$strSQL .= " * ";
$strSQL .= "FROM ";
$strSQL .= " rcv_tbl ";
$strSQL .= "WHERE ";
$strSQL .= " rcv_seikyukbn = ".$uriageMode." AND ";
$strSQL .= " rcv_area_id = ".$area_id[$intI]." AND ";
$strSQL .= " rcv_gyoumu_id = ".$gyoumu_id[$intI]." AND ";
if ($cboBunrui==""){
switch ($cboMode) {
case "1":
$strSQL .= " seikyu_kigen >='".$DateTitle[$intK]."/01' AND ";
$strSQL .= " seikyu_kigen <='".$DateTitle[$intK]."/99' ";
break;
case "2":
$strSQL .= " (";
$strSQL .= " (";
$strSQL .= " nyukin_date >='".$DateTitle[$intK]."/01' AND ";
$strSQL .= " nyukin_date <='".$DateTitle[$intK]."/99' ";
$strSQL .= " )";
$strSQL .= " OR ";
$strSQL .= " (";
$strSQL .= " nyukin_date = '' AND ";
$strSQL .= " seikyu_kigen >='".$DateTitle[$intK]."/01' AND ";
$strSQL .= " seikyu_kigen <='".$DateTitle[$intK]."/99' ";
$strSQL .= " ) ";
$strSQL .= " )";
break;
}
}else{
$strSQL .= DateGet($cboBunrui,$cboMode,$DateTitle[$intK]);
}
$objMRec = pg_exec($strSQL);
if($objMRec==false){
echo("SQL実行に失敗しました(SELECT)");
exit;
}
$rcv_id[$intI][$intK] = "";
$Chk_Flg = "0";
$seikyu_money[$intI][$intK] = "0";
$nyuukin_color[$intI][$intK] = "ConfKubunTd";
for ($intL = 0; $intL < pg_numrows($objMRec); $intL++) {
$objMData = pg_fetch_object($objMRec, $intL);
$Chk_Flg = "1";
if (pg_numrows($objMRec)==1){
$rcv_id[$intI][$intK] = $objMData->rcv_id;
}
if ($objMData->rcv_seikyukbn=="1"){
$MaxMoney1[$intK] = $MaxMoney1[$intK]+$objMData->seikyu_money;
}else{
$MaxMoney1[$intK] = $MaxMoney1[$intK]-$objMData->seikyu_money;
}
if ($objMData->nyukin_date==""){
if ($objMData->rcv_seikyukbn=="1"){
$seikyu_money[$intI][$intK] = $seikyu_money[$intI][$intK]+$objMData->seikyu_money;
}else{
$seikyu_money[$intI][$intK] = $seikyu_money[$intI][$intK]-$objMData->seikyu_money;
}
$nyuukin_color[$intI][$intK] = "ConfKubunRdTd";
}else{
if ($objMData->rcv_seikyukbn=="1"){
$seikyu_money[$intI][$intK] = $seikyu_money[$intI][$intK]+$objMData->nyukin_money;
}else{
$seikyu_money[$intI][$intK] = $seikyu_money[$intI][$intK]-$objMData->nyukin_money;
}
if ($objMData->rcv_seikyukbn=="1"){
$MaxMoney2[$intK] = $MaxMoney2[$intK]+$objMData->nyukin_money;
}else{
$MaxMoney2[$intK] = $MaxMoney2[$intK]-$objMData->nyukin_money;
}
}
}
if (($seikyu_money[$intI][$intK]!="0") || ($Chk_Flg=="1")){
$seikyu_money[$intI][$intK] = number_format($seikyu_money[$intI][$intK]);
}else{
$seikyu_money[$intI][$intK] = "";
}
}
}
//*** 合計 ***//
$Max_Value1 = 0;
$Max_Value2 = 0;
for ($intI = 0; $intI < 12; $intI++) {
$Max_Value1 = $Max_Value1 + $MaxMoney1[$intI];
$Max_Value2 = $Max_Value2 + $MaxMoney2[$intI];
$MaxMoney1[$intI] = number_format($MaxMoney1[$intI]);
$MaxMoney2[$intI] = number_format($MaxMoney2[$intI]);
}
$Max_Value1 = number_format($Max_Value1);
$Max_Value2 = number_format($Max_Value2);
//*** 未入力業務表示 ***//
if ($cboGyoumu==""){
$strWhere = "";
$strSQL = "SELECT ";
$strSQL .= " bumon_name, ";
$strSQL .= " gyoumu_id, ";
$strSQL .= " gyoumu_name, ";
$strSQL .= " gyoumu_money, ";
$strSQL .= " gyoumu_st_term, ";
$strSQL .= " gyoumu_ed_term, ";
$strSQL .= " mst_gyoumu.disp_rank ";
$strSQL .= "FROM ";
$strSQL .= " mst_gyoumu left join bumon_tbl on mst_gyoumu.gyoumu_area=bumon_tbl.bumon_seq ";
if ($cboArea!=""){
$strWhere = " WHERE gyoumu_area= ".$cboArea." ";
}
for ($intI = 0; $intI < count($gyoumu_id); $intI++) {
if ($strWhere==""){
$strWhere .= " WHERE ";
}else{
$strWhere .= " AND ";
}
$strWhere .= "gyoumu_id <> ".$gyoumu_id[$intI];
}
$strSQL .= $strWhere." ORDER BY mst_gyoumu.gyoumu_name";
//echo $strSQL."<hr>";
$objRec = pg_exec($strSQL);
if($objRec==false){
echo("SQL実行に失敗しました(SELECT)");
exit;
}
for ($intI = 0; $intI < pg_numrows($objRec); $intI++) {
$objData = pg_fetch_object($objRec, $intI);
$Idx = count($gyoumu_id);
$area_id[$Idx] = "";
$area_name[$Idx] = $objData->bumon_name;
$gyoumu_id[$Idx] = $objData->gyoumu_id;
//echo $Idx."-".$objData->gyoumu_name."<hr>";
$gyoumu_name[$Idx] = $objData->gyoumu_name;
if ($objData->gyoumu_money!=""){
$gyoumu_money[$Idx] = number_format($objData->gyoumu_money);
}else{
$gyoumu_money[$Idx] = $objData->gyoumu_money;
}
$gyoumu_st_term[$Idx] = substr($objData->gyoumu_st_term,2);
$gyoumu_ed_term[$Idx] = substr($objData->gyoumu_ed_term,2);
for ($intK = 0; $intK < count($DateTitle); $intK++) {
$rcv_id[$Idx][$intK] = "";
$seikyu_money[$Idx][$intK] = "0";
$nyuukin_color[$Idx][$intK] = "ConfKubunTd";
$seikyu_money[$Idx][$intK] = "";
}
}
}
//echo "あ".count($rcv_id);
//HTMLヘッダの書き出し
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; cahrset=euc-jp">
<meta http-equiv="content-style-type" content="text/css">
<meta name="robots" content="noindex, nofollow">
<script type="text/javascript" src="./js/RCV1000.js"></script>
<script type="text/javascript" src="./js/xmlhttp.js"></script>
<script type="text/javascript" src="./js/jkl-calendar.js" charset="Shift_JIS"></script>
<script type="text/javascript" src="./js/input_chk.js"></script>
<title><?PHP echo($PHP_SYSNAME); ?></title>
<link rel="stylesheet" href="./templates/css/RCV.css" type="text/css" />
<script>
var cal3 = new JKL.Calendar("calid3","frm","colname3");
var cal4 = new JKL.Calendar("calid4","frm","colname4");
</script>
</head>
<?PHP
//タイトル部分の表示
dspTitle($PHP_SYSNAME, $PHP_GROUP_NAME, $PHP_BUMON_NAME, $PHP_USER_NAME,"http://www.f-mtclab.net/article/134489389.html#help0");
//メインHTML部分の表示
//[0]システムURL、[1]HP URL、[2]マニュアルURL、[3]MTC HP URL、[4]マスタメールアドレス、
//[5]期間区分名、[6]大区分名、[7]小区分名、[8]支出名、[9]収入名、[10]消費税率(文字型)
$o_smarty->assign('DEFARR',$DEFARR);
$o_smarty->assign('PHP_SYSNAME',$PHP_SYSNAME);
$o_smarty->assign('PHP_GROUP_NAME',$PHP_GROUP_NAME);
$o_smarty->assign('PHP_BUMON_NAME',$PHP_BUMON_NAME);
$o_smarty->assign('PHP_USER_NAME',$PHP_USER_NAME);
$o_smarty->assign('PHP_USER_ADMIN',$PHP_USER_ADMIN);
$o_smarty->assign('PHP_USER_NYUKIN',$PHP_USER_NYUKIN);
$o_smarty->assign('PHP_USER_SHIKIN',$PHP_USER_SHIKIN);
//資金繰り
$o_smarty->assign('SIM_cboYaer', $SIM_cboYaer);
$o_smarty->assign('SIM_cboMon' , $SIM_cboMon);
$o_smarty->assign('SIM_cboKikan', $SIM_cboKikan);
$o_smarty->assign('BunruiData', $BunruiData);
$o_smarty->assign('AreaData' , $AreaData);
$o_smarty->assign('GyoumuData', $GyoumuData);
$o_smarty->assign('ModeData' , $ModeData);
$o_smarty->assign('DateTitle' , $DateTitle);
$o_smarty->assign('DateTitleDp', $DateTitleDp);
$o_smarty->assign('DateToday', $DateToday);
$o_smarty->assign('MaxMoney1' , $MaxMoney1);
$o_smarty->assign('MaxMoney2' , $MaxMoney2);
$o_smarty->assign('Max_Value1' , $Max_Value1);
$o_smarty->assign('Max_Value2' , $Max_Value2);
$o_smarty->assign('Money_Tani' , $Money_Tani); //金額単位
$o_smarty->assign('RCV_MODE' , $RCV_MODE); //請求モード
//開始日関連
$o_smarty->assign('Kijyun_Year' , $Kijyun_Year);
$o_smarty->assign('Kijyun_Month', $Kijyun_Month);
$o_smarty->assign('To_NYear' , $To_NYear);
$o_smarty->assign('To_NMonth', $To_NMonth);
$o_smarty->assign('Bf_Year' , $Bf_Year);
$o_smarty->assign('Bf_Month', $Bf_Month);
$o_smarty->assign('To_Year' , $To_Year);
$o_smarty->assign('To_Month', $To_Month);
$o_smarty->assign('Af_Year' , $Af_Year);
$o_smarty->assign('Af_Month', $Af_Month);
$o_smarty->assign('area_id' , $area_id);
$o_smarty->assign('area_name', $area_name);
$o_smarty->assign('gyoumu_id' , $gyoumu_id);
$o_smarty->assign('gyoumu_name' , $gyoumu_name);
$o_smarty->assign('gyoumu_money' , $gyoumu_money);
$o_smarty->assign('gyoumu_st_term' , $gyoumu_st_term);
$o_smarty->assign('gyoumu_ed_term' , $gyoumu_ed_term);
$o_smarty->assign('seikyu_money', $seikyu_money);
$o_smarty->assign('nyuukin_color', $nyuukin_color);
$o_smarty->assign('rcv_id', $rcv_id);
$o_smarty->assign('pageTTL', $pageTTL);
$o_smarty->assign('uriageMode', $uriageMode);
$o_smarty->assign('nameArr', $nameArr);
$o_smarty->assign('moneyType', $moneyType);
$o_smarty->display('RCV1000.tpl');
//フッタ部分の表示
dspFooter($DEFARR[1], $DEFARR[3],"http://www.f-mtclab.net/article/134489389.html#help0");
function getOrder($prm1,$prm2,&$outPrm){
//$prm1 = 1:部門 2:業務名 3:期間(開始) 4:受注額
//$prm2 = 1:ASC 2:DESC
$outPrm[0] = array("部門","業務名","期間","受注額");
$outPrm[1] = array("1,1","2,1","3,1","4,1");
$outSTR = "";
if($prm1 == "1"){
if($prm2 == "2"){
$outPrm[0][0] = "部門▼";
$outPrm[1][0] = "1,1";
$outSTR = "bumon_name DESC, gyoumu_name, gyoumu_st_term,gyoumu_money ";
}else{
$outPrm[0][0] = "部門▲";
$outPrm[1][0] = "1,2";
$outSTR = "bumon_name ASC, gyoumu_name, gyoumu_st_term,gyoumu_money ";
}
}else if($prm1 == "2"){
if($prm2 == "2"){
$outPrm[0][1] = "業務名▼";
$outPrm[1][1] = "2,1";
$outSTR = "gyoumu_name DESC,bumon_name, gyoumu_st_term,gyoumu_money ";
}else{
$outPrm[0][1] = "業務名▲";
$outPrm[1][1] = "2,2";
$outSTR = "gyoumu_name ASC,bumon_name, gyoumu_st_term,gyoumu_money ";
}
}else if($prm1 == "3"){
if($prm2 == "2"){
$outPrm[0][2] = "期間▼";
$outPrm[1][2] = "3,1";
$outSTR = "gyoumu_st_term DESC, bumon_name, gyoumu_name, gyoumu_money ";
}else{
$outPrm[0][2] = "期間▲";
$outPrm[1][2] = "3,2";
$outSTR = "gyoumu_st_term ASC, bumon_name, gyoumu_name, gyoumu_money ";
}
}else if($prm1 == "4"){
if($prm2 == "2"){
$outPrm[0][3] = "受注額▼";
$outPrm[1][3] = "4,1";
$outSTR = "gyoumu_money DESC, bumon_name, gyoumu_name, gyoumu_st_term ";
}else{
$outPrm[0][3] = "受注額▲";
$outPrm[1][3] = "4,2";
$outSTR = "gyoumu_money ASC, bumon_name, gyoumu_name, gyoumu_st_term ";
}
}
return $outSTR;
}
function DateGet($Ptn,$Mode,$strYm){
$strReturn = "";
//日付パターン取得
$strSQL = "SELECT * FROM bunrui_tbl WHERE bunrui_seq = ".$Ptn;
$objDateRec = pg_exec($strSQL);
if($objDateRec==false){
echo("SQL実行に失敗しました(SELECT)");
exit;
}
$objDateData = pg_fetch_object($objDateRec, 0);
$bName = $objDateData->bunrui_name;
$bStart = $objDateData->bunrui_start;
$bEnd = $objDateData->bunrui_end;
if ($bStart == $bEnd){
$DayValue = "";
switch ($bStart) {
case "98":
$chkDate = split("/", $strYm);
$Chk_Y = date("Y", mktime (0,0,0,intval($chkDate[1])+1,"1",$chkDate[0]));
$Chk_M = date("m", mktime (0,0,0,intval($chkDate[1])+1,"1",$chkDate[0]));
$Chk_D = date("d", mktime (0,0,0,intval($chkDate[1])+1,"1",$chkDate[0]));
$DayValue = date("d", mktime (0,0,0,intval($Chk_M),intval($Chk_D)-2,$Chk_Y));
break;
case "99":
$chkDate = split("/", $strYm);
$Chk_Y = date("Y", mktime (0,0,0,intval($chkDate[1])+1,"1",$chkDate[0]));
$Chk_M = date("m", mktime (0,0,0,intval($chkDate[1])+1,"1",$chkDate[0]));
$Chk_D = date("d", mktime (0,0,0,intval($chkDate[1])+1,"1",$chkDate[0]));
$DayValue = date("d", mktime (0,0,0,intval($Chk_M),intval($Chk_D)-1,$Chk_Y));
break;
default:
$DayValue = $bStart;
break;
}
switch ($Mode) {
case "1":
$strReturn = " seikyu_kigen ='".$strYm."/".sprintf('%02d', $DayValue)."' ";
break;
case "2":
$strReturn .= " (";
$strReturn .= " (";
$strReturn .= " nyukin_date ='".$strYm."/".sprintf('%02d', $DayValue)."' ";
$strReturn .= " )";
$strReturn .= " OR ";
$strReturn .= " (";
$strReturn .= " nyukin_date = '' AND ";
$strReturn .= " seikyu_kigen ='".$strYm."/".sprintf('%02d', $DayValue)."' ";
$strReturn .= " ) ";
$strReturn .= " )";
break;
}
}else{
$DayValue1 = "";
switch ($bStart) {
case "98":
$chkDate = split("/", $strYm);
$Chk_Y = date("Y", mktime (0,0,0,intval($chkDate[1])+1,"1",$chkDate[0]));
$Chk_M = date("m", mktime (0,0,0,intval($chkDate[1])+1,"1",$chkDate[0]));
$Chk_D = date("d", mktime (0,0,0,intval($chkDate[1])+1,"1",$chkDate[0]));
$DayValue1 = date("d", mktime (0,0,0,intval($Chk_M),intval($Chk_D)-2,$Chk_Y));
break;
case "99":
$chkDate = split("/", $strYm);
$Chk_Y = date("Y", mktime (0,0,0,intval($chkDate[1])+1,"1",$chkDate[0]));
$Chk_M = date("m", mktime (0,0,0,intval($chkDate[1])+1,"1",$chkDate[0]));
$Chk_D = date("d", mktime (0,0,0,intval($chkDate[1])+1,"1",$chkDate[0]));
$DayValue1 = date("d", mktime (0,0,0,intval($Chk_M),intval($Chk_D)-1,$Chk_Y));
break;
default:
$DayValue1 = $bStart;
break;
}
$DayValue2 = "";
switch ($bEnd) {
case "98":
$chkDate = split("/", $strYm);
$Chk_Y = date("Y", mktime (0,0,0,intval($chkDate[1])+1,"1",$chkDate[0]));
$Chk_M = date("m", mktime (0,0,0,intval($chkDate[1])+1,"1",$chkDate[0]));
$Chk_D = date("d", mktime (0,0,0,intval($chkDate[1])+1,"1",$chkDate[0]));
$DayValue2 = date("d", mktime (0,0,0,intval($Chk_M),intval($Chk_D)-2,$Chk_Y));
break;
case "99":
$chkDate = split("/", $strYm);
$Chk_Y = date("Y", mktime (0,0,0,intval($chkDate[1])+1,"1",$chkDate[0]));
$Chk_M = date("m", mktime (0,0,0,intval($chkDate[1])+1,"1",$chkDate[0]));
$Chk_D = date("d", mktime (0,0,0,intval($chkDate[1])+1,"1",$chkDate[0]));
$DayValue2 = date("d", mktime (0,0,0,intval($Chk_M),intval($Chk_D)-1,$Chk_Y));
break;
default:
$DayValue2 = $bEnd;
break;
}
switch ($Mode) {
case "1":
$strReturn .= " seikyu_kigen >='".$strYm."/".sprintf('%02d', $DayValue1)."' AND ";
$strReturn .= " seikyu_kigen <='".$strYm."/".sprintf('%02d', $DayValue2)."' ";
break;
case "2":
$strReturn .= " (";
$strReturn .= " (";
$strReturn .= " nyukin_date >='".$strYm."/".sprintf('%02d', $DayValue1)."' AND ";
$strReturn .= " nyukin_date <='".$strYm."/".sprintf('%02d', $DayValue2)."' ";
$strReturn .= " )";
$strReturn .= " OR ";
$strReturn .= " (";
$strReturn .= " nyukin_date = '' AND ";
$strReturn .= " seikyu_kigen >='".$strYm."/".sprintf('%02d', $DayValue1)."' AND ";
$strReturn .= " seikyu_kigen <='".$strYm."/".sprintf('%02d', $DayValue2)."' ";
$strReturn .= " ) ";
$strReturn .= " )";
break;
}
}
return $strReturn;
}
?>