echo sprintf("%03d", $counter->count() + 1); } else { if ($_POST['type'] == "upload") { try { $uploadDirectory = new fDirectory('../storage/image/' . $_POST['hiddenId']); } catch (fExpectedException $e) { $uploadDirectory = fDirectory::create('../storage/image/' . $_POST['hiddenId']); } try { $uploader = new fUpload(); $uploader->setMIMETypes(array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/png'), 'The file uploaded is not an image'); $uploader->enableOverwrite(); $file = $uploader->move($uploadDirectory, 'file'); $inv_item = new Inv_item($_POST['hiddenId']); $inv_item->setImageUrl('storage/image/' . $_POST['hiddenId'] . '/' . $file->getFilename()); $inv_item->store(); echo "Image uploaded"; } catch (fExpectedException $e) { echo $e->printMessage(); } } } } } } } } } else { if (isset($_GET['type'])) { if ($_GET['type'] == "uom") { try {
$purchase_detail = new Purchase_detail($row->{'detailId'}); } $purchase_detail->setDocNumber($key); $purchase_detail->setItemId($row->{'itemCode'}); $purchase_detail->setDescription($row->{'itemDesc'}); $purchase_detail->setQuantity($row->{'itemQuan'}); $purchase_detail->setUnitPrice($row->{'itemUnitP'}); $extendedPrice = $row->{'itemQuan'} * $row->{'itemUnitP'}; $total = $total + $extendedPrice; $purchase_detail->setExtendedPrice(round($extendedPrice, 2)); //$purchase_detail->setExtendedPrice($row->{'itemExtP'}); if ($_POST['approver_1'] != null && $_POST['approver_1_date'] != null) { $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) {