Esempio n. 1
0
                if ($invs) {
                    $inv = $invs[0];
                    $inv->in_stock_count = $invs[0]->in_stock_count + $p_item->quantity;
                    $item = new item();
                    $item->id = $p_item->item_id;
                    $item->getItem();
                    //                    $inv->selling_prize = $item->mrp;
                    $inv->tax_category_id = $item->tax_category_id;
                    $inv->updateInventry();
                } else {
                    $inv->in_stock_count = $p_item->quantity;
                    $item = new item();
                    $item->id = $p_item->item_id;
                    $item->getItem();
                    $inv->selling_prize = $item->mrp;
                    $inv->tax_category_id = $item->tax_category_id;
                    $inv->addInventry();
                }
            }
            if ($purchace->markAsStocked()) {
                $message = "Purchace added to stock succesfully";
                $responce = array('status' => 'success', 'error' => '', 'data' => array('message' => $message));
            } else {
                $responce = array('status' => 'failed', 'error' => 'Purchace already stocked', 'data' => array());
            }
        }
    }
} else {
    $responce = array('status' => 'failed', 'error' => 'Session expired', 'data' => array());
}
echo json_encode($responce);