phpBMS

root/trunk/phpbms/modules/bms/invoices_addedit.php

Revision 733, 30.8 KB (checked in by nate, 2 years ago)
  • Fixed credit memos' link back to their related invoice id.
  • Property svn:keywords set to LastChangedBy LastChangedDate LastChangedRevision
Line 
1<?php
2/*
3 $Rev$ | $LastChangedBy$
4 $LastChangedDate$
5 +-------------------------------------------------------------------------+
6 | Copyright (c) 2004 - 2010, Kreotek LLC                                  |
7 | All rights reserved.                                                    |
8 +-------------------------------------------------------------------------+
9 |                                                                         |
10 | Redistribution and use in source and binary forms, with or without      |
11 | modification, are permitted provided that the following conditions are  |
12 | met:                                                                    |
13 |                                                                         |
14 | - Redistributions of source code must retain the above copyright        |
15 |   notice, this list of conditions and the following disclaimer.         |
16 |                                                                         |
17 | - Redistributions in binary form must reproduce the above copyright     |
18 |   notice, this list of conditions and the following disclaimer in the   |
19 |   documentation and/or other materials provided with the distribution.  |
20 |                                                                         |
21 | - Neither the name of Kreotek LLC nor the names of its contributore may |
22 |   be used to endorse or promote products derived from this software     |
23 |   without specific prior written permission.                            |
24 |                                                                         |
25 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS     |
26 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT       |
27 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
28 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT      |
29 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,   |
30 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT        |
31 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,   |
32 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY   |
33 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT     |
34 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE   |
35 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.    |
36 |                                                                         |
37 +-------------------------------------------------------------------------+
38*/
39
40        include("../../include/session.php");
41        include("include/tables.php");
42        include("include/fields.php");
43        include("include/invoices.php");
44
45        if(!isset($_GET["backurl"]))
46                $backurl = NULL;
47        else{
48                $backurl = $_GET["backurl"];
49                if(isset($_GET["refid"]))
50                        $backurl .= "?refid=".$_GET["refid"];
51        }
52
53        $thetable = new invoices($db,"tbld:62fe599d-c18f-3674-9e54-b62c2d6b1883",$backurl);
54        $therecord = $thetable->processAddEditPage();
55
56        if($thetable->lineitems === NULL)
57                $thetable->lineitems = new lineitems($db, $therecord["id"], $therecord["type"]);
58        else
59                $thetable->lineitems->invoicetype = $therecord["type"];
60
61        $phpbms->cssIncludes[] = "pages/invoice.css";
62        $phpbms->jsIncludes[] = "modules/bms/javascript/invoice.js";
63        $phpbms->jsIncludes[] = "modules/bms/javascript/invoiceaddress.js";
64        $phpbms->jsIncludes[] = "modules/bms/javascript/paymentprocess.js";
65
66        if(isset($therecord["phpbmsStatus"]))
67                $statusmessage = $therecord["phpbmsStatus"];
68
69
70                //Form Elements
71                //==============================================================
72                $theform = new phpbmsForm();
73
74                $theinput = new inputField("theid", $therecord["id"], "id", false, NULL, 11);
75                $theinput->setAttribute("readonly", "readonly");
76                $theinput->setAttribute("class", "uneditable");
77                $theform->addField($theinput);
78
79                $theinput = new inputSmartSearch($db, "clientid", "Pick Sales Order Client", $therecord["clientid"], "client", true, 68, 255, false);
80                $theform->addField($theinput);
81
82                $theinput = new inputDatePicker("orderdate", $therecord["orderdate"], "order date");
83                $theform->addField($theinput);
84
85                $theinput = new inputDatePicker("invoicedate", $therecord["invoicedate"], "invoice date");
86                $theform->addField($theinput);
87
88                $theinput = new inputDatePicker("requireddate", $therecord["requireddate"], "required date");
89                $theform->addField($theinput);
90
91                $theinput = new inputBasicList("type",$therecord["type"],array("Quote"=>"Quote","Order"=>"Order"), NULL, true);
92                $theinput->setAttribute("class","important");
93                $theform->addField($theinput);
94
95                $checkDisabled = false;
96                if($therecord["type"] == "VOID" || $therecord["type"] == "Invoice")
97                        $checkDisabled = true;
98
99                $theinput = new inputCheckbox("iscreditmemo", $therecord["iscreditmemo"], "credit memo", $checkDisabled);
100                $theform->addField($theinput);
101
102                $theinput = new inputField("cmid", $therecord["cmid"], "related invoice id", false, NULL, 11);
103                        $theinput->setAttribute("readonly", "readonly");
104                $theinput->setAttribute("class", "uneditable");
105                $theform->addField($theinput);
106
107                $theinput = new inputDatePicker("statusdate", $therecord["statusdate"], "status date");
108                $theform->addField($theinput);
109
110                $theinput = new inputSmartSearch($db, "assignedtoid", "Pick Active User", $therecord["assignedtoid"], "assigned to", false, 36);
111                $theform->addField($theinput);
112
113                $theinput = new inputCheckBox("readytopost",$therecord["readytopost"],"ready to post");
114                $theform->addField($theinput);
115
116                $theinput = new inputCheckBox("weborder",$therecord["weborder"],NULL, false, false);
117                $theform->addField($theinput);
118
119                $theinput = new inputChoiceList($db,"leadsource",$therecord["leadsource"],"leadsource", "lead source");
120                $theform->addField($theinput);
121
122                if($therecord["type"]!="VOID" && $therecord["type"]!="Invoice"){
123
124                        $theinput = new inputSmartSearch($db, "productid", "Pick Product", "", NULL, false, 36, 255, false);
125                        $theform->addField($theinput);
126
127                }//endif = ORDER
128
129                $theinput = new inputField("address1",$therecord["address1"],"address",false,NULL,71,128,false);
130                $theform->addField($theinput);
131
132                $theinput = new inputField("address2",$therecord["address2"],NULL,false,NULL,71,128, false);
133                $theform->addField($theinput);
134
135                $theinput = new inputField("city",$therecord["city"],NULL,false,NULL,35,64);
136                $theform->addField($theinput);
137
138                $theinput = new inputField("state",$therecord["state"],"state/province",false,NULL,10,20);
139                $theform->addField($theinput);
140
141                $theinput = new inputField("postalcode",$therecord["postalcode"],"zip/postal code",false,NULL,12,15);
142                $theform->addField($theinput);
143
144                $theinput = new inputField("country",$therecord["country"],NULL,false,NULL,44,128);
145                $theform->addField($theinput);
146
147                $theinput = new inputCheckBox("shiptosameasbilling",$therecord["shiptosameasbilling"],"shipping address same as billing");
148                $theform->addField($theinput);
149
150                $saveOptionList = array(
151                        "sales order only" => "orderOnly",
152                        "update client address" => "updateAddress",
153                        "create new client address" => "createAddress"
154                );
155                $theinput = new inputBasicList("billingsaveoptions","orderOnly",$saveOptionList, "saving");
156                $theform->addField($theinput);
157
158
159                $theinput = new inputField("shiptoname",$therecord["shiptoname"],"ship to name",false,NULL,71,128);
160                $theform->addField($theinput);
161
162                $theinput = new inputField("shiptoaddress1",$therecord["shiptoaddress1"],"address",false,NULL,71,128, false);
163                $theform->addField($theinput);
164
165                $theinput = new inputField("shiptoaddress2",$therecord["shiptoaddress2"],NULL,false,NULL,71,128, false);
166                $theform->addField($theinput);
167
168                $theinput = new inputField("shiptocity",$therecord["shiptocity"],"city",false,NULL,35,64);
169                $theform->addField($theinput);
170
171                $theinput = new inputField("shiptostate",$therecord["shiptostate"],"state/province",false,NULL,10,20);
172                $theform->addField($theinput);
173
174                $theinput = new inputField("shiptopostalcode",$therecord["shiptopostalcode"],"zip/postal code",false,NULL,12,15);
175                $theform->addField($theinput);
176
177                $theinput = new inputField("shiptocountry",$therecord["shiptocountry"],"country",false,NULL,44,128);
178                $theform->addField($theinput);
179
180                $theinput = new inputBasicList("shiptosaveoptions","orderOnly",$saveOptionList, "address save options");
181                $theform->addField($theinput);
182
183
184                $theinput = new inputPercentage("taxpercentage",$therecord["taxpercentage"], "tax percentage" , 5);
185                $theinput->setAttribute("onchange","clearTaxareaid()");
186                $theform->addField($theinput);
187
188                $theinput = new inputCurrency("creditlimit", $therecord["creditlimit"], "credit limit" );
189                $theinput->setAttribute("readonly","readonly");
190                $theform->addField($theinput);
191
192                $theinput = new inputCurrency("creditleft", $therecord["creditleft"], "credit left (before order)" );
193                $theinput->setAttribute("readonly","readonly");
194                $theform->addField($theinput);
195
196                //=====Payment Info====================
197
198
199                $theinput = new inputComparisonField("accountnumber",$therecord["accountnumber"],  "account number" ,false, NULL, 20, 64);
200                $theform->addField($theinput);
201
202                $theinput = new inputComparisonField("routingnumber",$therecord["routingnumber"],  "routing number" ,false, NULL, 30, 64);
203                $theform->addField($theinput);
204
205                $theinput = new inputComparisonField("ccnumber", $therecord["ccnumber"], "card number", false, NULL, 28, 40);
206                $theform->addField($theinput);
207
208                $theinput = new inputComparisonField("ccexpiration", $therecord["ccexpiration"], "expiration", false, NULL, 8, 10);
209                $theform->addField($theinput);
210
211                $theinput = new inputComparisonField("ccverification", $therecord["ccverification"], "verification", false, NULL, 8, 7);
212                $theform->addField($theinput);
213
214                //======================================
215
216                $thetable->getCustomFieldInfo();
217                $theform->prepCustomFields($db, $thetable->customFieldsQueryResult, $therecord);
218                $theform->jsMerge();
219                //==============================================================
220                //End Form Elements
221
222
223        $pageTitle = "Sales Order";
224        if($therecord["iscreditmemo"])
225                $pageTitle = "Credit Memo";
226
227        $_SESSION["printing"]["tableid"]="tbld:62fe599d-c18f-3674-9e54-b62c2d6b1883";
228        $_SESSION["printing"]["theids"]=array($therecord["id"]);
229
230        $shippingMethods = $thetable->getShipping($therecord["shippingmethodid"]);
231        $paymentMethods = $thetable->getPayments($therecord["paymentmethodid"]);
232        $statuses = $thetable->getStatuses($therecord["statusid"]);
233        $cmrecords = $thetable->getCreditMemos($therecord["uuid"]);
234        if(count($cmrecords)){
235                $pageTitle = $pageTitle."*";
236        }
237
238        if($therecord["type"]=="VOID" || $therecord["type"]=="Invoice")
239                $phpbms->bottomJS[] = 'disableSaves(document.forms["record"]);';
240
241        include("header.php");
242
243
244?><form action="<?php echo htmlentities($_SERVER["REQUEST_URI"]) ?>"
245        method="post" name="record" id="record"><div id="dontSubmit"><input type="submit" value=" " onclick="return false;" /></div>
246<?php $phpbms->showTabs("invoices entry","tab:20276b44-9cfa-403e-4c2a-ac6f0987ae20",$therecord["id"]);?><div class="bodyline">
247        <div id="topButtons">
248                  <?php if($therecord["id"]){
249                                ?><div id="printButton">
250                                <input name="doprint" type="button" value="print" accesskey="p" onclick="doPrint('<?php echo APP_PATH?>',<?php echo $therecord["id"]?>)" class="Buttons" />
251                        </div><?php
252                        }//end if
253                        showSaveCancel(1); ?>
254        </div>
255        <h1 id="h1With<?php if(!$therecord["id"]) echo "out"?>Print"><?php echo $pageTitle ?></h1>
256        <?php if(count($cmrecords)){ ?>
257                <p class="notes">
258                        *this record has associated credit memos
259                </p>
260        <?php }//end if ?>
261
262        <input type="hidden" id="processPayment" value="<?php if(isset($_POST["saveandprocess"])) echo $_POST["saveandprocess"]; ?>" />
263
264        <div id="fsAttributes">
265                <fieldset >
266                        <legend>attributes</legend>
267
268                        <div id="attributesRight">
269                                <p><?php $theform->showField("orderdate"); ?></p>
270
271                                <p><?php $theform->showField("invoicedate"); ?></p>
272
273                                <p><?php $theform->showField("requireddate"); ?></p>
274                        </div>
275
276                        <div>
277                                <p><?php $theform->showField("theid")?></p>
278
279                                <p>
280                                        <?php  if($therecord["type"]=="VOID" || $therecord["type"]=="Invoice") {?>
281                                                <label for="type" class="important">type</label><br />
282                                                <input id="type" name="type" type="text" value="<?php echo htmlQuotes($therecord["type"])?>" size="11" maxlength="11" readonly="readonly" class="uneditable important" />
283                                        <?php }else {
284                                                $theform->fields["type"]->display();
285                                        }?><input type="hidden" id="oldType" name="oldType" value="<?php echo $therecord["type"]?>"/>
286                                </p>
287
288                                <p>
289                                        <label for="ponumber">client PO#</label>
290                                        <br />
291                                        <input name="ponumber" id="ponumber" type="text" value="<?php echo htmlQuotes($therecord["ponumber"])?>" size="11" maxlength="64"/>
292                                </p>
293
294                                <p><?php $theform->showfield("iscreditmemo"); ?></p>
295
296                                <?php
297                                $style = "display:none;";
298                                if($therecord["iscreditmemo"] && $therecord["cmuuid"])
299                                        $style = "display:block;";
300                                ?>
301                                <p id="cmidP" style="<?php echo $style; ?>">
302                                        <?php $theform->showfield("cmid"); ?>
303                                        <button class="graphicButtons buttonInfo CMButtons" title="view record" type="button" id="cmb-<?php echo $therecord["cmid"];?>">
304                                                <span>view record</span>
305                                        </button>
306                                </p>
307                        </div>
308
309                        <p>
310                                <?php $theform->fields["leadsource"]->display() ?>
311                        </p>
312
313                </fieldset>
314
315                <fieldset>
316                        <legend>Status</legend>
317                        <p>
318                                <label for="statusid" class="important">current status</label><br />
319                                <?php $thetable->showStatusDropDown($therecord["statusid"],$statuses)?>
320                                <input type="hidden" id="statuschanged" name="statuschanged" value="<?php if($therecord["id"]=="") echo "1"; else echo "0"?>" />
321                        </p>
322                        <p>
323                                <?PHP $theform->fields["statusdate"]->display();?>
324                        </p>
325                        <div class="fauxP">
326                                <?php $theform->fields["assignedtoid"]->display(); ?>
327                        </div>
328                        <p>
329                                <?php $theform->showField("readytopost"); ?>
330                        </p>
331                </fieldset>
332        </div>
333
334        <div id="fsTops">
335                <fieldset>
336                        <legend><label for="ds-clientid">client</label></legend>
337                        <div class="fauxP big">
338                                <input type="hidden" id="clientAddEditFile" value="<?php echo getAddEditFile($db, "tbld:6d290174-8b73-e199-fe6c-bcf3d4b61083") ?>"/>
339                                <input type="hidden" id="clientRealId" value="<?php echo $therecord["clientrealid"]?>"/>
340                                <?php $thetable->showClientType($therecord["clientid"])?>
341
342                                <?php $theform->showField("clientid")?>
343
344                                <button id="viewClientButton" type="button" title="view client" class="graphicButtons buttonInfo"><span>view client</span></button>
345                        </div>
346                </fieldset>
347
348                <fieldset id="fsAddresses">
349                        <legend>addresses</legend>
350                        <ul class="tabs">
351                                <li class="tabsSel"><a href="#" id="tabBilling">billing address</a></li>
352                                <li><a href="#" id="tabShipTo">shipping address</a></li>
353                        </ul>
354                        <div id="billingAddressDiv">
355                                <input type="hidden" id="billingaddressid" name="billingaddressid" value="<?php echo $therecord["billingaddressid"]?>" />
356                                <p>
357                                        <label for="address1">address</label>
358                                        <button type="button" class="graphicButtons buttonMap" id="buttonMapBilling" title="show map"><span>map</span></button>
359                                        <br />
360                                        <?php $theform->showField("address1");?><br />
361                                        <?php $theform->showField("address2");?>
362                                </p>
363
364                                <p class="cityState"><?php $theform->showField("city");?></p>
365
366                                <p class="cityState"><?php $theform->showField("state");?></p>
367
368                                <p><?php $theform->showField("postalcode");?></p>
369
370                                <p>
371                                        <?php $theform->showField("country");?>
372                                </p>
373
374                                <p>
375                                        <?php $theform->showField("shiptosameasbilling")?>
376                                </p>
377
378                                <p><button id="buttonAddressBilling" class="graphicButtons buttonDown showoptions" type="button"><span>more options</span></button></p>
379
380                                <div id="addressOptionsDivBilling">
381                                        <fieldset>
382                                                <legend>address</legend>
383                                                <p><label>replace</label><br />
384                                                        <button type="button" class="<?php if(!$therecord["clientid"]) {?>disabled<?php }//endif - clientid?>Buttons addressButtons" id="addressLoadButtonBilling">load...</button>
385                                                        <button type="button" class="Buttons addressButtons" id="addressClearButtonBilling">clear</button>
386                                                </p>
387                                                <p><?php $theform->showField("billingsaveoptions")?></p>
388                                        </fieldset>
389                                </div>
390
391                        </div>
392
393                        <div id="shiptoAddressDiv">
394                                <input type="hidden" id="shiptoaddressid" name="shiptoaddressid" value="<?php echo $therecord["shiptoaddressid"]?>" />
395                                <p>
396                                        <?php $theform->showField("shiptoname");?>
397                                        <br /><span class="notes">(if different from client)</span>
398                                </p>
399                                <p>
400                                        <label for="shiptoaddress1">address</label>
401                                        <button type="button" class="graphicButtons buttonMap" id="buttonMapShipping" title="show map"><span>map</span></button>
402                                        <br />
403                                        <?php $theform->showField("shiptoaddress1");?><br />
404                                        <?php $theform->showField("shiptoaddress2");?>
405                                </p>
406                                <p class="cityState">
407                                        <?php $theform->showField("shiptocity");?>
408                                </p>
409                                <p class="cityState">
410                                        <?php $theform->showField("shiptostate");?>
411                                </p>
412                                <p>
413                                        <?php $theform->showField("shiptopostalcode");?>
414                                </p>
415                                <p>
416                                        <?php $theform->showField("shiptocountry");?>
417                                </p>
418
419                                <p><button id="buttonAddressShipTo" class="graphicButtons buttonDown showoptions" type="button"><span>more options</span></button></p>
420
421                                <div id="addressOptionsDivShipTo">
422                                        <fieldset>
423                                                <legend>address</legend>
424                                                <p><label>replace</label><br />
425                                                        <button type="button" class="<?php if(!$therecord["clientid"]) {?>disabled<?php }//endif - clientid?>Buttons addressButtons" id="addressLoadButtonShipping">load...</button>
426                                                        <button type="button" class="Buttons addressButtons" id="addressClearButtonShipping">clear</button>
427                                                </p>
428                                                <p><?php $theform->showField("shiptosaveoptions")?></p>
429                                        </fieldset>
430                                </div>
431
432                        </div>
433                </fieldset>
434
435                <fieldset>
436                        <legend>web</legend>
437                        <p>     <label for="weborder">web / confirmation number</label><br />
438                                <?php $theform->fields["weborder"]->display();?>
439                                <input name="webconfirmationno" type="text" value="<?php echo htmlQuotes($therecord["webconfirmationno"]) ?>" size="64" maxlength="64"/>
440                        </p>
441                </fieldset>
442        </div>
443
444<fieldset id="lineItemsFS">
445        <legend>line items</legend>
446
447        <input type="hidden" name="thelineitems" id="thelineitems" />
448        <input type="hidden" id="lineitemschanged" name="lineitemschanged" />
449
450        <input id="partnumber" name="partnumber" type="hidden" value="" />
451        <input id="partname" name="partname" type="hidden" value="" />
452        <input id="unitcost" name="unitcost" type="hidden" value="0" />
453        <input id="unitweight" name="unitweight" type="hidden" value="0"/>
454        <input id="taxable" name="taxable" type="hidden" value="1"/>
455        <input id="imgpath" name="imgpath" type="hidden" value="<?php echo APP_PATH ?>common/stylesheet/<?php echo STYLESHEET ?>/image" />
456
457        <table border="0" cellpadding="0" cellspacing="0" id="LITable">
458                <thead>
459                        <tr id="LIHeader">
460                                <th nowrap="nowrap" class="queryheader" align="left" colspan="2">product</th>
461                                <th nowrap="nowrap" class="queryheader" align="left" id="memoHeader">memo</th>
462                                <th align="right" nowrap="nowrap" class="queryheader">price</th>
463                                <th align="right" nowrap="nowrap" class="queryheader">qty.</th>
464                                <th align="right" nowrap="nowrap" class="queryheader" colspan="2" id="liHeaderExtendedTd">extended</th>
465                        </tr>
466                </thead>
467
468                <tbody>
469                <?php if($therecord["type"]!="Invoice" && $therecord["type"]!="VOID"){?>
470                <tr id="LIAdd">
471                        <td colspan="2"><?php $theform->showField("productid")?></td>
472                        <td><input name="memo" type="text" id="memo" size="12" maxlength="255" /></td>
473                        <td align="right" nowrap="nowrap"><input name="price" type="text" id="price" value="<?php echo htmlQuotes(numberToCurrency(0))?>" size="10" maxlength="16" class="fieldCurrency" /></td>
474                        <td align="center" nowrap="nowrap"><input name="qty" type="text" id="qty" value="1" size="5" maxlength="16" /></td>
475                        <td align="right" nowrap="nowrap"id="liAddExtendedTD"><input name="extended" type="text" id="extended" class="uneditable fieldCurrency" value="<?php echo htmlQuotes(numberToCurrency(0))?>" size="12" maxlength="16" readonly="readonly" /></td>
476                        <td nowrap="nowrap" align="left" id="liAddButtonTd"><button type="button" id="lineitemAddButton" class="graphicButtons buttonPlus" title="Add Line Item"><span>+</span></button></td>
477                </tr><?php }//end if
478
479                $thetable->lineitems->show($therecord["thelineitems"]);
480
481                ?><tr id="LITotals">
482                <td colspan="3" rowspan="8" align="right" valign="top">
483
484                        <div id="vContent1" class="vContent">
485                                <fieldset>
486                                        <legend>Discount / Promotion</legend>
487                                        <p id="pDiscount">
488                                                <label for="discountid">discount</label><br />
489                                                <?php $thetable->showDiscountSelect($therecord["discountid"])?>
490                                        </p>
491                                        <input type="hidden" id="discount" name="discount" value="<?php echo $therecord["discount"]?>" />
492                                </fieldset>
493                        </div>
494
495                        <div id="vContent2" class="vContent">
496                                <fieldset>
497                                        <legend>Tax</legend>
498                                        <p>
499                                                <label for="taxareaid">tax area</label><br />
500                                                <?php $thetable->showTaxSelect($therecord["taxareaid"])?>
501                                        </p>
502                                        <p>
503                                                <?php $theform->fields["taxpercentage"]->display();?>
504                                        </p>
505                                </fieldset>
506                        </div>
507
508                        <div id="vContent3" class="vContent">
509                                <fieldset>
510                                        <legend>Shipping</legend>
511                                        <p id="pTotalweight">
512                                                <label for="totalweight">total wt.</label><br/>
513                                                <input id="totalweight" name="totalweight" type="text" value="<?php echo $therecord["totalweight"]?>" size="5" maxlength="15" readonly="readonly" class="uneditable" />
514                                        </p>
515
516                                        <p>
517                                                <label for="shippingmethodid">ship via</label><br />
518                                                <?php  $thetable->showShippingSelect($therecord["shippingmethodid"],$shippingMethods);
519                                                        $shipButtonDisable="";
520                                                        if($therecord["shippingmethodid"]=="")
521                                                                $shipButtonDisable="Disabled";
522                                                        else{
523                                                                if($shippingMethods[$therecord["shippingmethodid"]]["canestimate"]==0)
524                                                                        $shipButtonDisable="Disabled";
525                                                        }
526                                                ?>
527                                                <button id="estimateShippingButton" type="button" onclick="startEstimateShipping()" class="graphicButtons buttonShip<?php echo $shipButtonDisable?>" title="Estimate Shipping"><span>Estimate Shipping</span></button>
528                                        </p>
529                                        <div id="shippingNotice">
530                                                <p class="notes">
531                                                        The shipping estimate establishes an outside connection to a shipping provider
532                                                        in order to estimate the shipping for the order.
533                                                </p>
534                                                <p class="notes">
535                                                        Make sure the products have weight and shipping information entered, that the client
536                                                        has a valid shipping address, and that the company address information has been entered.
537                                                </p>
538                                                <p><label for="shippingNoticeResults">estimation results</label><br /><textarea readonly="readonly" id="shippingNoticeResults" rows="5" cols=""></textarea></p>
539                                                <p align="right">
540                                                        <button type="button" class="Buttons" onclick="performShippingEstimate('<?php echo APP_PATH ?>')">estimate</button>
541                                                        <button type="button" class="Buttons" onclick="closeModal()">done</button>
542                                                </p>
543                                        </div>
544
545                                        <p>
546                                                <label for="trackingno">tracking number</label><br />
547                                                <input id="trackingno" name="trackingno" type="text" value="<?php echo htmlQuotes($therecord["trackingno"]) ?>" size="50" maxlength="64" />
548                                        </p>
549                                </fieldset>
550                        </div>
551
552                        <div id="vContent4" class="vContent">
553                                <fieldset>
554                                        <legend>Payment</legend>
555                                        <?php if(hasRights("role:de7e6679-8bb2-29ee-4883-2fcd756fb120")){ ?>
556                                        <p>
557                                                <label for="paymentmethodid">payment method</label><br />
558                                                <?php $thetable->showPaymentSelect($therecord["paymentmethodid"],$paymentMethods);
559                                                        $paymentButtonDisable="";
560                                                        if($therecord["paymentmethodid"]==0)
561                                                                $paymentButtonDisable="Disabled";
562                                                        else
563                                                                if($paymentMethods[$therecord["paymentmethodid"]]["onlineprocess"]==0)
564                                                                        $paymentButtonDisable="Disabled";
565                                                ?>
566                                                <button id="paymentProcessButton" type="button" class="graphicButtons buttonMoney<?php echo $paymentButtonDisable?>" title="process payment online"><span>process payment online</span></button>
567                                                <input type="hidden" id="processscript"/>
568                                                <input type="hidden" id="saveandprocess" name="saveandprocess"/>
569                                        </p>
570
571                                        <div id="checkpaymentinfo">
572                                                <p id="pCheckNumber">
573                                                        <label for="checkno">check number</label><br />
574                                                        <input name="checkno" type="text" id="checkno" value="<?php echo htmlQuotes($therecord["checkno"])?>" size="20" maxlength="32" />
575                                                </p>
576                                                <p>
577                                                        <label for="bankname">bank name</label><br />
578                                                        <input id="bankname" name="bankname" type="text" value="<?php echo htmlQuotes($therecord["bankname"]) ?>" size="30" maxlength="64" />
579                                                </p>
580                                                <p id="pAccountNumber">
581                                                        <?php $theform->showfield("accountnumber"); ?>
582                                                </p>
583                                                <p>
584                                                        <?php $theform->showfield("routingnumber"); ?>
585                                                </p>
586                                        </div>
587
588                                        <div id="ccpaymentinfo">
589                                                <p id="fieldCCNumber">
590                                                        <?php $theform->showfield("ccnumber"); ?>
591                                                </p>
592                                                <p id="fieldCCExpiration">
593                                                        <?php $theform->showfield("ccexpiration"); ?>
594                                                </p>
595                                                <p>
596                                                        <?php $theform->showfield("ccverification"); ?>
597                                                </p>
598                                        </div>
599
600                                        <div id="receivableinfo">
601
602                                                <input type="hidden" id="hascredit" value="<?php echo $therecord["hascredit"]?>"/>
603
604                                                <p><?php $theform->showField("creditlimit")?></p>
605
606                                                <p><?php $theform->showField("creditleft")?></p>
607
608                                                <p class="notes">
609                                                        Payments made to accounts receivable invoices are done through
610                                                        the disbursements area.
611                                                </p>
612                                        </div>
613
614                                        <p id="pTransactionid">
615                                                <label for="transactionid">transaction id</label><br />
616                                                <input type="text" id="transactionid" name="transactionid" value="<?php echo htmlQuotes($therecord["transactionid"])?>" size="32" maxlength="64" />
617                                        </p>
618
619                                        <?php } else {?>
620                                        <p class="notes">You do not have rights to view payment details.</p>
621                                        <?php } ?>
622                                </fieldset>
623                        </div>
624
625                        <table border="0" cellpadding="0" cellspacing="0" id="parenInfo">
626                                <tbody>
627                                        <tr><td id="parenDiscount"><?php if($therecord["discountname"])  echo "(".htmlQuotes($therecord["discountname"]).")"; else echo "&nbsp;"; ?></td></tr>
628                                        <tr><td class="blanks">&nbsp;</td></tr>
629                                        <tr><td id="parenTax">
630                                                <?php
631                                                        if($therecord["taxname"] || ((int) $therecord["taxpercentage"])!=0){
632                                                                echo "(";
633                                                                if($therecord["taxname"]) echo formatVariable($therecord["taxname"]).": ";
634                                                                echo $therecord["taxpercentage"]."%)";
635                                                        } else echo "&nbsp;";
636                                                ?>
637                                        </td></tr>
638                                        <tr><td id="parenShipping">
639                                                <?php
640                                                        if($therecord["shippingmethodid"]){
641                                                                echo "(".htmlQuotes($shippingMethods[$therecord["shippingmethodid"]]["name"]).")";
642                                                        }else{
643                                                                echo "&nbsp;";
644                                                        }
645                                                        ?>
646                                        </td></tr>
647                                        <tr><td class="blanks">&nbsp;</td></tr>
648                                        <tr><td id="parenSpacer" class="blanks">&nbsp;</td></tr>
649                                        <tr><td id="parenPayment"><?php if($therecord["paymentmethodid"]!="") echo "(".htmlQuotes($paymentMethods[$therecord["paymentmethodid"]]["name"]).")"; else echo "&nbsp;"?></td></tr>
650                                </tbody>
651                        </table>
652
653                </td>
654                <td colspan="2" class="invoiceTotalLabels vTabs" id="vTab1"><div>discount<input type="hidden" id="totalBD" name="totalBD" value="<?php echo $therecord["totaltni"]+$therecord["discountamount"]?>" /></div></td>
655                <td class="totalItems"><input name="discountamount" id="discountamount" type="text" value="<?php echo numberToCurrency($therecord["discountamount"])?>" size="12" maxlength="15" onchange="clearDiscount();calculateTotal();" class="fieldCurrency fieldTotal"/></td>
656                <td class="totalItems">&nbsp;</td>
657  </tr><tr>
658                <td colspan="2" class="invoiceTotalLabels"><div>subtotal</div></td>
659                <td class="totalItems"><input class="uneditable fieldCurrency fieldTotal" name="totaltni" id="totaltni" type="text" value="<?php echo numberToCurrency($therecord["totaltni"])?>" size="12"  maxlength="15" readonly="readonly" onchange="calculateTotal();" /></td>
660                <td class="totalItems">&nbsp;</td>
661        </tr>
662        <tr>
663                <td colspan="2" class="invoiceTotalLabels vTabs" id="vTab2"><div>tax</div></td>
664                <td class="totalItems"><input name="tax" id="tax" type="text" value="<?php echo numberToCurrency($therecord["tax"])?>" size="12" maxlength="15" onchange="changeTaxAmount()" class="fieldCurrency fieldTotal" /></td>
665                <td class="totalItems">&nbsp;</td>
666        </tr>
667        <tr>
668                <td colspan="2" class="invoiceTotalLabels vTabs" id="vTab3"><div>shipping</div></td>
669                <td class="totalItems"><input name="shipping" id="shipping" type="text" value="<?php echo numberToCurrency($therecord["shipping"])?>" size="12" maxlength="15" onchange="calculateTotal();" class="fieldCurrency fieldTotal" /></td>
670                <td class="totalItems">&nbsp;</td>
671        </tr>
672        <tr id="totalDisplayTr">
673                <td colspan="2" class="invoiceTotalLabels important"><div>total</div></td>
674                <td class="totalItems">
675                        <input class="uneditable fieldCurrency important fieldTotal" name="totalti" id="totalti" type="text" value="<?php echo numberToCurrency($therecord["totalti"])?>" size="12" maxlength="15" onchange="calculateTotal();"  readonly="readonly" />
676                        <input id="totalcost" name="totalcost" type="hidden" value="<?php echo $therecord["totalcost"] ?>" />
677                        <input id="totaltaxable" name="totaltaxable" type="hidden" value="<?php echo $therecord["totaltaxable"] ?>" />
678                </td>
679                <td class="totalItems">&nbsp;</td>
680        </tr>
681        <tr>
682                <td colspan="4" class="invoiceTotalLabels" id="totalSpacer"><div>&nbsp;</div></td>
683        </tr>
684        <tr>
685                <td colspan="2" class="invoiceTotalLabels vTabs" id="vTab4"><div>payment</div></td>
686                <td class="totalItems"><input name="amountpaid" id="amountpaid" type="text" value="<?php echo numberToCurrency($therecord["amountpaid"])?>" size="12" maxlength="15" onchange="calculatePaidDue();"  class="important fieldCurrency fieldTotal" /></td>
687                <td class="totalItems"><button id="payinfull" type="button" onclick="payInFull()" class="graphicButtons buttonCheck" title="Pay in full"><span>pay in full</span></button></td>
688        </tr>
689        <tr id="lastTotalsTr">
690                <td colspan="2" class="invoiceTotalLabels" nowrap="nowrap"><div>amount due</div></td>
691                <td class="totalItems"><input id="amountdue" name="amountdue" type="text" value="<?php echo numberToCurrency($therecord["amountdue"]) ?>" size="12" maxlength="15" onchange="calculatePaidDue();" class="important fieldCurrency fieldTotal" /></td>
692                <td class="totalItems">&nbsp;</td>
693        </tr>
694        </tbody>
695</table>
696</fieldset>
697
698<fieldset id="fsInstructions">
699        <legend>instructions</legend>
700        <p>
701                <label for="specialinstructions">special instructions</label>
702                <span class="notes"><em>(will not print on invoice)</em></span><br />
703                <textarea id="specialinstructions" name="specialinstructions" cols="45" rows="3"><?php echo $therecord["specialinstructions"]?></textarea>
704        </p>
705        <p>
706                <label for="printedinstructions">printed instructions</label><br />
707                <textarea id="printedinstructions" name="printedinstructions" cols="45" rows="3"><?php echo $therecord["printedinstructions"]?></textarea>
708        </p>
709
710</fieldset>
711
712<?php if(count($cmrecords)){ ?>
713        <fieldset>
714                <legend>Associated Credit Memos</legend>
715
716                <?php $thetable->showCreditMemos($cmrecords); ?>
717
718        </fieldset>
719<?php }//end if ?>
720
721<?php $theform->showCustomFields($db, $thetable->customFieldsQueryResult) ?>
722
723<?php $theform->showGeneralInfo($phpbms,$therecord) ?>
724</div>
725</form>
726<?php include("footer.php");?>
Note: See TracBrowser for help on using the browser.
phpBMS vulnerability assesment provided by Orvant Inc. Copyright © 2010 Kreotek, LLC. All Rights reserved.