$counter = 1;
        $totalchecker = 0;
        foreach ($purchase_details as $purchase_detail) {
            echo "<tr><td>" . $counter . "</td><td>" . $purchase_detail->prepareItemId() . "</td>";
            $item = new Inv_item($purchase_detail->getItemId());
            echo "<td>" . $purchase_detail->prepareDescription() . "</td><td>" . $purchase_detail->prepareQuantity() . "</td>\n\t\t\t\t\t\t\t \t<td>" . $item->prepareUnitOfMeasure() . "</td><td>" . $purchase_detail->prepareUnitPrice() . "</td>\n\t\t\t\t\t\t\t\t<td>" . $purchase_detail->prepareExtendedPrice() . "</td></tr>";
            $totalchecker = $totalchecker + $purchase_detail->getExtendedPrice();
            $counter++;
        }
        ?>
			</tbody>
			<?php 
        $totalchecker = $totalchecker - $purchase->getDiscount();
        if ($totalchecker != $purchase->getTotal()) {
            $purchaseNu = new Purchase($_GET['id']);
            $purchaseNu->setTotal($totalchecker);
            $purchaseNu->store();
        }
        ?>
			<tfoot>
				<tr><td colspan="5"></td><td>Discount</td><td><?php 
        echo $purchase->prepareDiscount(2);
        ?>
</td></tr>
				<tr><td colspan="5" id="addRowBTN"><div class="ui-icon ui-icon-circle-plus span-1 last"></div>Add Row</td><td class="tfootCaption">Total</td><td id="purchaseTotal"><?php 
        echo $purchase->prepareTotal(2);
        ?>
</td></tr>
			</tfoot>
		</table>
		<div class="pdbox span-11"><label>Payment Terms</label><br /><?php 
예제 #2
0
                     $item = new Inv_item($row->{'itemCode'});
                     $item->setCurrencyId($purchase->getCurrency());
                     $item->setRate($row->{'itemUnitP'});
                     $item->store();
                 }
                 if (!$error) {
                     $purchase_detail->store();
                 }
             } catch (fExpectedException $e) {
                 echo $e->printMessage();
                 $error = true;
             }
         }
         if (!$error) {
             $total = $total - $_POST['discount'];
             $purchase->setTotal(round($total, 2));
             $purchase->store();
         }
     } catch (fExpectedException $e) {
         echo $e->printMessage();
         $error = true;
     }
 } else {
     if ($_POST['type'] == "countPR") {
         $countPR = Purchase::findByBranch(fRequest::get('branch', 'string'), fRequest::get('doctype', 'string'));
         echo sprintf("%03d", $countPR->count() + 1);
     } else {
         if ($_POST['type'] == "json") {
             $purchasedetails = Purchase_detail::findDetail($_POST['key']);
             echo $purchasedetails->toJSON();
         } else {