コード例 #1
0
        void AddItem(string sType, string sBarcode, string sDesc, string sCategory, string sRRP, string sVAT, string sMinQty, decimal dCatTwoItemCost, decimal dQIS, string sParentCode, decimal dCPartQTY, string sSupplier, decimal dSupCost, string sSupCode, string sAveCost)
        {
            string sShopCode = "";

            sShopCode = fbEdit.ShopCode;
            sEngine.RemoveSuppliersForItem(sBarcode, sSupplier);
            if (sType == "1" || sType == "3")
            {
                sEngine.AddEditItem(sShopCode, sBarcode, sDesc,
                                    sType, sCategory, sRRP, sVAT,
                                    sMinQty, sAveCost);

                decimal dCurrentStockLevel = Convert.ToDecimal(sEngine.GetItemStockStaRecord(sBarcode, sShopCode)[36]);
                if (dQIS > dCurrentStockLevel)
                {
                    GetPassword();
                    sEngine.TransferStockItem("BH", sShopCode, sBarcode, dQIS - dCurrentStockLevel, false);
                }
                else if (dQIS < dCurrentStockLevel)
                {
                    GetPassword();
                    sEngine.TransferStockItem(sShopCode, "BH", sBarcode, dCurrentStockLevel - dQIS, false);
                }
                if (sSupplier != "")
                {
                    sEngine.AddSupplierForItem(sBarcode, sSupplier, dSupCost.ToString(), sSupCode);
                }
            }
            else if (sType == "2")
            {
                try
                {
                    sEngine.AddEditItem(sShopCode, sBarcode, sDesc, sType,
                                        sCategory, sVAT, sMinQty, dCatTwoItemCost, Convert.ToDecimal(sEngine.GetItemStockStaRecord(sBarcode, sShopCode)[39])); // Last field should be target margin
                }
                catch
                {
                    sEngine.AddEditItem(sShopCode, sBarcode, sDesc, sType,
                                        sCategory, sVAT, sMinQty, dCatTwoItemCost, 0.00m); // Last field should be target margin
                }
            }
            else if (sType == "5")
            {
                sEngine.AddEditItem(sShopCode, sBarcode, sDesc,
                                    sType, sCategory, sRRP, sVAT,
                                    sMinQty, sParentCode, dCPartQTY.ToString());
            }
            else if (sType == "6")
            {
                sEngine.AddEditItem(sShopCode, sBarcode, sDesc,
                                    sType, sCategory, sRRP, sVAT,
                                    sMinQty, sSupplier, dSupCost, "0");
            }
        }