/var/www/hkosl.com/innoutstorage/webadmin/payment_modifyform.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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
<?php
    
require_once('check_login.php');

    
$_SESSION["_payment_type"] = $_GET["type"];

    
//$_SESSION["index_url_parameter"] = get_index_url_parameter();

    
$payment_info     get_payment_by_id((int)$_GET["id"]);
    
$payment_dtl_info get_payment_dtl((int)$_GET["id"]);
    
$customer_info    get_customer($payment_info["customer_id"]);

    
//$payment_method_info = get_master_type_code("PAYMENT_METHOD", $payment_info["paymethod"]);

    
$sql99        "SELECT * FROM sys_cms_login WHERE cmsloginid=?";
    
$parameters99 = array((int)$payment_info{'lastupby'});
    
$row99        bind_pdo($sql99$parameters99"selectone");

    
/*$this_payment_type_total_amt = 0;
    foreach ($payment_dtl_info as $key => $payment_dtl) {
        if ($payment_dtl["payable_type"] == $_SESSION["_payment_type"]) {
            $this_payment_type_total_amt+=$payment_dtl["amount"];
        }
    }*/

    
$has_deposit false;
    
$has_invoice false;
    foreach (
$payment_dtl_info as $key => $payment_dtl) {
        if (
$payment_dtl["payable_type"] == "DEPOSIT") {
            
$has_deposit true;
        }

        if (
$payment_dtl["payable_type"] == "INVOICE") {
            
$has_invoice true;
        }
    }

    if (
$has_deposit && $has_invoice) {
        
$payfor "ALL";
    } else if (
$has_deposit) {
        
$payfor "DEPOSIT";
    } else if (
$has_invoice) {
        
$payfor "INVOICE";
    }
?>
<!DOCTYPE html>
<html>
<head>
    <?php require_once('html_head.php'); ?>

</head>
<body>
<form action="payment_modify.php" method="post" name="addform" enctype="multipart/form-data" class="form_field">
    <input type="hidden" name="payment_id" value="<?= (int)$_GET["id"?>"/>
    <input type="hidden" name="type" value="<?= $_GET["type"?>"/>

    <table width="800" border="0" cellpadding="0" cellspacing="0">
        <tr>
            <td height="70" align="right" valign="middle" class="icontxt">
                <table border="0" cellpadding="0" cellspacing="0">
                    <tr>
                        <td width="150" align="center" style="font-size: 12px;">

                            <?php if ($payfor == "ALL") { ?>
                                <div onclick="location.href='output_payment2.php?payment_id=<?= (int)$_GET["id"?>&type=ALL'" style="cursor:pointer; display: inline-block;">
                                    <img src="images/print.png" width="32" height="32" border="0"/> <br> &nbsp;合併列印&nbsp;&nbsp;
                                </div>
                            <?php ?>
                            <div onclick="location.href='output_payment2.php?payment_id=<?= (int)$_GET["id"?>&type=<?= $_GET["type"?>'" style="cursor:pointer; display: inline-block;">
                                <img src="images/print.png" width="32" height="32" border="0"/> <br>
                                &nbsp;列印<?= $_SESSION["_payment_type"] == "DEPOSIT" "按金收據" "正式收據" ?>&nbsp;&nbsp;
                            </div>

                        </td>

                        <td width="50" align="center" style="font-size: 12px;">
                            <input type="image" alt="submit" src="images/iconSave.png" width="32" height="32" border="0"><br>
                            &nbsp;儲存&nbsp;&nbsp;</a></td>
                        <td width="50" align="center">
                            <a href="<?= "payment_index.php?" $_SESSION["index_url_parameter"] . "&msg=取消" ?>"><img src="images/iconCancel.png" alt="Cancel" width="32" height="32" border="0"><br>
                                &nbsp;取消&nbsp;&nbsp;</a></td>
                        <td>&nbsp;</td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td class="pagetitletxt">
                &nbsp;&nbsp;<b><img src="images/iconList.jpg" width="48" height="48" align="absmiddle"/>查閱 <?= $_SESSION["_payment_type"] == "DEPOSIT" "按金收據" "正式收據" ?>
                </b>
                <span style="float:right;" class="msg">最近更新: <?= $row99{'cmsusername'} . '&nbsp;&nbsp;&nbsp;' $payment_info{'lastupdate'}; ?></span>
            </td>
        </tr>
        <tr>
            <td align="left" valign="middle"><!-- Content -->

                <table border="0" cellpadding="0" cellspacing="0">

                    <tr>
                        <td width="120" align="right" valign="top" class='content'>客戶</td>
                        <td width="5" valign="top" class='content'>:&nbsp;</td>
                        <td class='content'>
                            <?= $customer_info["customer_name"] . ' (' $customer_info["code"] . ')'?>
                            <br><br>
                        </td>
                    </tr>

                    <tr>
                        <td width="120" align="right" valign="top" class='content '>付款方式</td>
                        <td width="5" valign="top" class='content'>:&nbsp;</td>
                        <td class='content'>
                            <?php
                                
if ($_GET["type"] == "INVOICE") {
                                    
$this_paymethod_info get_master_type_code("PAYMENT_METHOD"$payment_info["paymethod2"]);

                                    echo 
$this_paymethod_info["name_tc"] . ' <br>';

                                    if (
$payment_info["paymethod2"] == "CHEQUE") {
                                        echo 
'銀行名稱 : ' $payment_info["bank_name2"] . '<br>
                                        支票號碼 : ' 
$payment_info["cheque_num2"] . '<br>';
                                    }

                                    if (
$payment_info["paymethod2"] == "OTHER" || $payment_info["paymethod2"] == "BANKIN") {
                                        echo 
$payment_info["paymethod_other2"] . '<br>';
                                    }
                                } else if (
$payment_info["payfor"] == "ALL" || $_GET["type"] == "DEPOSIT") {
                                    
$this_paymethod_info get_master_type_code("PAYMENT_METHOD"$payment_info["paymethod"]);

                                    echo 
$this_paymethod_info["name_tc"] . ' <br>';

                                    if (
$payment_info["paymethod"] == "CHEQUE") {
                                        echo 
'銀行名稱 : ' $payment_info["bank_name"] . '<br>
                                        支票號碼 : ' 
$payment_info["cheque_num"] . '<br>';
                                    }

                                    if (
$payment_info["paymethod"] == "OTHER" || $payment_info["paymethod"] == "BANKIN") {
                                        echo 
$payment_info["paymethod_other"] . '<br>';
                                    }

                                }

                            
?>
                            <br>
                        </td>
                    </tr>

                    <tr>
                        <td width="120" align="right" valign="top" class='content '>金額</td>
                        <td width="5" valign="top" class='content'>:&nbsp;</td>
                        <td class='content'>
                            $<?= numberformat($payment_info["amount"]) ?><br><br>
                            <!--$<? /*=numberformat($this_payment_type_total_amt)*/ ?><br><br>-->
                        </td>
                    </tr>

                    <tr>
                        <td width="120" align="right" valign="top" class='content '>付款日期</td>
                        <td width="5" valign="top" class='content'>:&nbsp;</td>
                        <td class='content'>
                            <?= $payment_info["docdate"?>
                            <br><br>
                        </td>
                    </tr>

                    <tr>
                        <td width="120" align="right" valign="top" class='content '>付款項目</td>
                        <td width="5" valign="top" class='content'>:&nbsp;</td>
                        <td class='content'>
                            <?php
                                
echo "<table id='unpaid_payment_table'>";
                                echo 
"<tr>";
                                echo 
"<td>類別</td>";
                                echo 
"<td>發票編號</td>";
                                echo 
"<td>發票日期</td>";
                                echo 
"<td>發票到期</td>";
                                echo 
"<td>付款金額</td>";
                                echo 
"</tr>";

                                foreach (
$payment_dtl_info as $key => $payment_dtl) {

                                    
/*if($payment_dtl["payable_type"] != $_SESSION["_payment_type"])
                                        continue;*/

                                    
echo "<tr>";

                                    
$payment_type get_master_type_code("PAYMENT_TYPE"$payment_dtl["payable_type"]);

                                    echo 
"<td>" $payment_type["name_tc"] . "</td>";

                                    
$sql                "select * from " mb_strtolower($payment_dtl["payable_type"]) . " where id = ?";
                                    
$parameters         = array($payment_dtl["payable_id"]);
                                    
$payable_table_info bind_pdo($sql$parameters"selectone");

                                    echo 
"<td><a href='" mb_strtolower($payment_dtl["payable_type"]) . "_modifyform.php?id=" $payment_dtl["payable_id"] . "' style='text-decoration: underline;' target='_blank'> " $payable_table_info["code"] . "</a></td>";

                                    echo 
"<td>" $payable_table_info["docdate"] . "</td>";

                                    
/*if($payment_dtl["payable_type"] == "DEPOSIT"){
                                        echo "<td>" . date("Y-m-d", strtotime($payable_table_info["docdate"])) . "</td>";
                                    }else{
                                        echo "<td>" . $payable_table_info["duedate"] . "</td>";

                                    }*/
                                    
echo "<td>" $payable_table_info["duedate"] . "</td>";

                                    echo 
"<td>$" numberformat($payment_dtl["amount"]) . "</td>";
                                }

                                echo 
"</table>";
                            
?>
                            <br>
                        </td>
                    </tr>

                    <tr>
                        <td width="120" align="right" valign="top" class='content '>備註</td>
                        <td width="5" valign="top" class='content'>:&nbsp;</td>
                        <td class='content'>
                            <textarea name="remark" style="width: 300px; height: 50px;"><?= ($payment_info["remark"]) ?></textarea>
                            <br><br>
                        </td>
                    </tr>
                </table>
                <!-- End Content -->
            </td>
        </tr>
        <tr>
            <td align="left" valign="middle">&nbsp;</td>
        </tr>
    </table>
</form>
</body>
</html>