RCV1010.php
6.76 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
<?PHP
//*****************************************************************************
//* プログラム名:請求・入金管理
//* プログラムID:RCV1010.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');
$rcv_id = $_POST["rcv_id"];
$div_id = $_POST["div_id"];
//モード 1:売上 2:外注
$uriageMode = $uriageMode;
//*** 請求・入金初期情報 ***//
$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";
}
//*** 基本情報 ***//
$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;
}
switch ($uriageMode) {
case "1":
$LstHead = "入金";
break;
case "2":
$LstHead = "支払";
break;
}
if ($Reload==1){
$cboInpArea = $cboInpArea;
$cboInpGyousya = $cboInpGyousya;
$cboInpGyoumu = $cboInpGyoumu;
$txtInpKigen = $txtInpKigen;
$txtInpMoney = $txtInpMoney;
$txtInpNDate = $txtInpNDate;
$txtInpNMoney = $txtInpNMoney;
$txtInpMemo = $txtInpMemo;
$txtCalKigen = $txtInpKigen;
$txtCalNDate = $txtInpNDate;
}else if ($rcv_id !=""){
//修正
$strSQL = "SELECT * FROM rcv_tbl WHERE rcv_id = ".$rcv_id;
$objRec = pg_exec($strSQL);
if($objRec==false){
echo("SQL実行に失敗しました(SELECT)");
exit;
}
$objData = pg_fetch_object($objRec, 0);
$cboInpArea = $objData->rcv_area_id;
$cboInpGyousya = $objData->rcv_gyousya_id;
$cboInpGyoumu = $objData->rcv_gyoumu_id;
if ($objData->rcv_seikyukbn=="1"){
$optSeikyukbn[1] = "checked";
$optSeikyukbn[2] = "";
}else{
$optSeikyukbn[1] = "";
$optSeikyukbn[2] = "checked";
}
$txtInpKigen = $objData->seikyu_kigen;
$txtInpMoney = $objData->seikyu_money;
$txtInpNDate = $objData->nyukin_date;
$txtInpNMoney = $objData->nyukin_money;
$txtInpMemo = $objData->memo_txt;
$txtCalKigen = $objData->seikyu_kigen;
$txtCalNDate = $objData->nyukin_date;
if ($chkDisp==""){
$chkDisp=0;
}
}else{
$cboInpArea = "";
$cboInpGyousya = "";
$cboInpGyoumu = "";
$optSeikyukbn[1] = "checked";
$optSeikyukbn[2] = "";
$txtInpMoney = "";
$txtInpKigen = "";
$txtInpNDate = "";
$txtInpNMoney = "";
$txtInpMemo = "";
$txtCalKigen = date("Y/m/d");
$txtCalNDate = date("Y/m/d");
if ($chkDisp==""){
$chkDisp=1;
}
}
if ($chkDisp==1){
$chkSel = "checked";
}else{
$chkSel = "";
}
//*** 拠点情報 ***//
$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;
}
$AreaData = '';
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);
if (($intCnt==0) && ($cboInpArea=="")){
$cboInpArea = $objData->bumon_seq;
}
$AreaData .= '<OPTION value="'.$objData->bumon_seq.'" ';
if ($cboInpArea==$objData->bumon_seq){
$AreaData.="selected";
}
$AreaData .='>'.$objData->bumon_name.'</OPTION>';
}
}
//*** 業者情報 ***//
$GyousyaData = '';
$strSQL = "SELECT * FROM mst_gyousya ";
switch ($uriageMode) {
case "1":
$strSQL .= "WHERE disp_mode1=1 ";
break;
case "2":
$strSQL .= "WHERE disp_mode2=1 ";
break;
}
$strSQL .= "ORDER BY gyousya_name";
$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);
$GyousyaData .= '<OPTION value="'.$objData->gyousya_id.'" ';
if ($cboInpGyousya==$objData->gyousya_id){
$GyousyaData.="selected";
}
$GyousyaData .='>'.$objData->gyousya_name.'</OPTION>';
}
//*** 業務情報 ***//
$GyoumuData = '';
$strSQL = "SELECT * FROM mst_gyoumu WHERE gyoumu_area=".$cboInpArea;
if ($chkDisp==1){
$strSQL .= " AND gyoumu_ed_term>='".$Kijyun_Year."/".$Kijyun_Month."/01' ";
}
$strSQL .= " ORDER BY gyoumu_name";
$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);
$GyoumuData .= '<OPTION value="'.$objData->gyoumu_id.'" ';
if ($cboInpGyoumu==$objData->gyoumu_id){
$GyoumuData.="selected";
}
$koban="";
if(trim($objData->gyoumu_koban)!=""){
$koban=trim($objData->gyoumu_koban)." ";
}
$GyoumuData .='>'.$koban.$objData->gyoumu_name.'</OPTION>';
}
$o_smarty->assign('Money_Tani' , $Money_Tani); //金額単位
$o_smarty->assign('RCV_MODE' , $RCV_MODE); //請求管理モード
$o_smarty->assign('LstHead' , $LstHead); //一覧タイトル
$o_smarty->assign('rcv_id' , $rcv_id); // キー
$o_smarty->assign('div_id' , $div_id); // DIVの場所
$o_smarty->assign('AreaData' , $AreaData); // 拠点情報
$o_smarty->assign('GyousyaData' , $GyousyaData); // 業者情報
$o_smarty->assign('GyoumuData', $GyoumuData); // 業務情報
$o_smarty->assign('chkSel' , $chkSel); // 業務情報
$o_smarty->assign('optSeikyukbn', $optSeikyukbn); // 業務情報
$o_smarty->assign('txtInpKigen' , $txtInpKigen); // 支払い期限
$o_smarty->assign('txtInpMoney' , $txtInpMoney); // 請求金額
$o_smarty->assign('txtInpNDate' , $txtInpNDate); // 入金日
$o_smarty->assign('txtInpNMoney' , $txtInpNMoney); // 入金額
$o_smarty->assign('txtCalSeikyu' , $txtCalSeikyu); // 入金額
$o_smarty->assign('txtCalKigen' , $txtCalKigen); // 入金額
$o_smarty->assign('txtCalNDate' , $txtCalNDate); // 入金額
;
$o_smarty->assign('txtInpMemo' , $txtInpMemo); // メモ
$o_smarty->display('RCV1010.tpl');
?>