示例#1
0
 public function generatePurchaseOrder($supplierid, $date, $items)
 {
     $supplier = Supplier::GetSupplier($supplierid);
     $order = PurchaseOrder::CreateOrder($supplier, $date);
     foreach ($items as $item) {
         $ql = PurchaseOrderLine::Create($order->id, $item['item'], $item['qty'], $item['price']);
         $order->addToOrder($ql);
     }
     $voucher = $order->generate();
     if ($voucher) {
         echo json_encode($voucher);
     } else {
         echo 0;
     }
 }