| 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/discounts.php"); |
|---|
| 44 | |
|---|
| 45 | $thetable = new discounts($db,"tbld:455b8839-162b-3fcb-64b6-eeb946f873e1"); |
|---|
| 46 | $therecord = $thetable->processAddEditPage(); |
|---|
| 47 | |
|---|
| 48 | if(isset($therecord["phpbmsStatus"])) |
|---|
| 49 | $statusmessage = $therecord["phpbmsStatus"]; |
|---|
| 50 | |
|---|
| 51 | $stats = $thetable->getTotals($therecord["id"]); |
|---|
| 52 | |
|---|
| 53 | $pageTitle="Discount / Promotion"; |
|---|
| 54 | |
|---|
| 55 | $phpbms->cssIncludes[] = "pages/discounts.css"; |
|---|
| 56 | $phpbms->jsIncludes[] = "modules/bms/javascript/discount.js"; |
|---|
| 57 | $phpbms->onload[] = "init();"; |
|---|
| 58 | |
|---|
| 59 | //Form Elements |
|---|
| 60 | //============================================================== |
|---|
| 61 | $theform = new phpbmsForm(); |
|---|
| 62 | |
|---|
| 63 | $theinput = new inputCheckbox("inactive",$therecord["inactive"]); |
|---|
| 64 | $theform->addField($theinput); |
|---|
| 65 | |
|---|
| 66 | $theinput = new inputField("name",$therecord["name"],NULL,true,NULL,32,64); |
|---|
| 67 | $theinput->setAttribute("class","important"); |
|---|
| 68 | $theform->addField($theinput); |
|---|
| 69 | |
|---|
| 70 | $theinput = new inputPercentage("percentvalue",$therecord["value"],"value",2,true); |
|---|
| 71 | $theform->addField($theinput); |
|---|
| 72 | |
|---|
| 73 | $theinput = new inputCurrency("amountvalue",$therecord["value"], "value" ,true); |
|---|
| 74 | $theform->addField($theinput); |
|---|
| 75 | |
|---|
| 76 | $thetable->getCustomFieldInfo(); |
|---|
| 77 | $theform->prepCustomFields($db, $thetable->customFieldsQueryResult, $therecord); |
|---|
| 78 | $theform->jsMerge(); |
|---|
| 79 | //============================================================== |
|---|
| 80 | //End Form Elements |
|---|
| 81 | |
|---|
| 82 | include("header.php"); |
|---|
| 83 | |
|---|
| 84 | ?><div class="bodyline"> |
|---|
| 85 | <?php $theform->startForm($pageTitle)?> |
|---|
| 86 | |
|---|
| 87 | <div id="fsAttributes"> |
|---|
| 88 | <fieldset> |
|---|
| 89 | <legend>attributes</legend> |
|---|
| 90 | <p> |
|---|
| 91 | <?php $theform->showField("inactive")?> |
|---|
| 92 | </p> |
|---|
| 93 | </fieldset> |
|---|
| 94 | |
|---|
| 95 | <fieldset> |
|---|
| 96 | <legend>statistics</legend> |
|---|
| 97 | <p> |
|---|
| 98 | <strong>Orders</strong> (<?php echo $stats["Order"]["total"]?>)<br/> |
|---|
| 99 | total: <?php echo numberToCurrency($stats["Order"]["sum"])?> |
|---|
| 100 | </p> |
|---|
| 101 | <p> |
|---|
| 102 | <strong>Invoices</strong> (<?php echo $stats["Invoice"]["total"]?>)<br /> |
|---|
| 103 | total: <?php echo numberToCurrency($stats["Invoice"]["sum"])?> |
|---|
| 104 | </p> |
|---|
| 105 | </fieldset> |
|---|
| 106 | </div> |
|---|
| 107 | |
|---|
| 108 | <div id="nameDiv"> |
|---|
| 109 | <fieldset> |
|---|
| 110 | <legend>name</legend> |
|---|
| 111 | <p class="big"> |
|---|
| 112 | <?php $theform->showField("name") ?> |
|---|
| 113 | </p> |
|---|
| 114 | </fieldset> |
|---|
| 115 | |
|---|
| 116 | <fieldset> |
|---|
| 117 | <legend>discount</legend> |
|---|
| 118 | <p> |
|---|
| 119 | <strong>type</strong><br /> |
|---|
| 120 | <input type="radio" class="radiochecks" id="typePercentage" name="type" value="percent" <?php if($therecord["type"]=="percent") echo "checked=\"checked\"" ?> onclick="changeType()" /><label for="typePercentage">percentage</label> |
|---|
| 121 | |
|---|
| 122 | <input type="radio" class="radiochecks" id="typeAmount" name="type" value="amount" <?php if($therecord["type"]=="amount") echo "checked=\"checked\"" ?> onclick="changeType()" /><label for="typeAmount">amount</label> |
|---|
| 123 | </p> |
|---|
| 124 | <p id="pValue"> |
|---|
| 125 | <?php $theform->showField("percentvalue");?> |
|---|
| 126 | </p> |
|---|
| 127 | <p id="aValue"> |
|---|
| 128 | <?php $theform->showField("amountvalue");?> |
|---|
| 129 | </p> |
|---|
| 130 | </fieldset> |
|---|
| 131 | |
|---|
| 132 | <fieldset> |
|---|
| 133 | <legend><label for="description">description</label></legend> |
|---|
| 134 | <p> |
|---|
| 135 | <span class="notes">(description is used on invoice reports)</span><br /> |
|---|
| 136 | <textarea id="description" name="description" cols="38" rows="4"><?php echo htmlQuotes($therecord["description"])?></textarea> |
|---|
| 137 | </p> |
|---|
| 138 | </fieldset> |
|---|
| 139 | |
|---|
| 140 | <?php $theform->showCustomFields($db, $thetable->customFieldsQueryResult) ?> |
|---|
| 141 | |
|---|
| 142 | </div> |
|---|
| 143 | |
|---|
| 144 | <?php |
|---|
| 145 | $theform->showGeneralInfo($phpbms,$therecord); |
|---|
| 146 | $theform->endForm(); |
|---|
| 147 | ?> |
|---|
| 148 | </div> |
|---|
| 149 | <?php include("footer.php");?> |
|---|