public usrc_Edit_Item_Unit() { InitializeComponent(); dPriceSum_v = new decimal_v(0); dPricePerUnit_v = new decimal_v(); dQuantity_v = new decimal_v(); m_Unit = new Unit(); //lbl_Price.Text = ""; chk_Unit.CheckedChanged += Chk_Unit_CheckedChanged; chk_Unit.Checked = false; enable(chk_Unit.Checked); }
public SampleDB_Price_ShopB_Item( string xShopB_Item_Name, string xShopB_Item_Abbreviation, bool xShopB_Item_bToOffer, Image xShopB_Item_Image, int_v xShopB_Item_Code_v, string xShopB_Item_ParentGroup1, string xShopB_Item_ParentGroup2, string xShopB_Item_ParentGroup3, string xPriceList_Name, bool xPriceList_valid, DateTime_v xPriceList_ValidFrom_v, DateTime_v xPriceList_ValidTo_v, DateTime_v xPriceList_CreationDate_v, string xPriceList_Description, string xCurrency_Abbreviation, string xCurrency_Name, string xCurrency_Symbol, int xCurrencyCode, int xCurrency_DecimalPlaces, string xTaxationName, decimal xTaxationRate, decimal xRetailShopB_ItemPrice, decimal_v xDiscount_v) { ShopB_Item_Name = xShopB_Item_Name; ShopB_Item_Abbreviation = xShopB_Item_Abbreviation; ShopB_Item_bToOffer = xShopB_Item_bToOffer; ShopB_Item_Image = xShopB_Item_Image; ShopB_Item_Code_v = xShopB_Item_Code_v; ShopB_Item_ParentGroup1 = xShopB_Item_ParentGroup1; ShopB_Item_ParentGroup2 = xShopB_Item_ParentGroup2; ShopB_Item_ParentGroup3 = xShopB_Item_ParentGroup3; PriceList_Name = xPriceList_Name; PriceList_valid = xPriceList_valid; PriceList_ValidFrom_v = xPriceList_ValidFrom_v; PriceList_ValidTo_v = xPriceList_ValidTo_v; PriceList_CreationDate_v = xPriceList_CreationDate_v; PriceList_Description = xPriceList_Description; Currency_Abbreviation = xCurrency_Abbreviation; Currency_Name = xCurrency_Name; Currency_Symbol = xCurrency_Symbol; CurrencyCode = xCurrencyCode; Currency_DecimalPlaces = xCurrency_DecimalPlaces; TaxationName = xTaxationName; TaxationRate = xTaxationRate; RetailShopB_ItemPrice = xRetailShopB_ItemPrice; Discount_v = xDiscount_v; }
public Form_Discount(decimal xRetailPrice, decimal_v xPurchasePrice_v, decimal xDiscount, string xsItemName) { InitializeComponent(); PurchasePrice_v = xPurchasePrice_v; sItemName = xsItemName; if (sItemName == null) { sItemName = "???"; } if (xPurchasePrice_v == null) { btn_PurchasePriceInfo.Visible = false; } lngRPM.s_rdb_CustomDiscount.Text(rdb_Custom); lngRPM.s_rdb_EndPrice.Text(rdb_EndPrice); lngRPM.s_btn_PurchasePriceInfo.Text(btn_PurchasePriceInfo); ExtraDiscount = xDiscount; SetCurrentDiscount(xDiscount); RetailPrice = xRetailPrice; nm_UpDown_Discount.Value = 0; nm_UpDown_EndPrice.Value = xRetailPrice; nm_UpDown_Discount.Minimum = -10000000000; nm_UpDown_Discount.Increment = 1; nm_UpDown_Discount.Maximum = +10000000000; int_v iDecimalPlaces_v = new int_v(); iDecimalPlaces_v.v = TangentaDB.GlobalData.BaseCurrency.DecimalPlaces; nm_UpDown_EndPrice.Maximum = 100000000000M; nm_UpDown_EndPrice.Minimum = 0M; decimal dincrement = fs.GetIncrement(iDecimalPlaces_v, null); nm_UpDown_EndPrice.Increment = dincrement; nm_UpDown_EndPrice.DecimalPlaces = iDecimalPlaces_v.v; nm_UpDown_Discount.DecimalPlaces = 2; nm_UpDown_EndPrice.Enabled = false; AddHandlers(); DialogResult = DialogResult.Cancel; string s_RetailPrice = fs.Decimal2String(RetailPrice, GlobalData.BaseCurrency.DecimalPlaces) + " " + GlobalData.BaseCurrency.Abbreviation; lngRPM.s_Price.Text(sItemName+", ", this, " = " +s_RetailPrice); }
public static bool Get(long_v Language_ID_v, string doc_page_type_Name, string doc_page_type_Description, decimal Page_Width, decimal Page_Height, ref long doc_page_type_ID, string doc_type_Name, string doc_type_Description, ref long doc_type_ID, string doc_Name, string doc_Description, byte[] doc, bool Compressed, bool Active, bool Default, ref long doc_ID ) { string_v doc_page_type_Description_v = new string_v(doc_page_type_Description); decimal_v Width_v = new decimal_v(Page_Width); decimal_v Height_v = new decimal_v(Page_Height); if (f_doc_page_type.Get(doc_page_type_Name, doc_page_type_Description_v, Width_v, Height_v, ref doc_page_type_ID)) { string_v doc_type_Description_v = new string_v(doc_type_Description); long_v doc_page_type_ID_v = new long_v(doc_page_type_ID); if (f_doc_type.Get(doc_type_Name, doc_type_Description_v, Language_ID_v, doc_page_type_ID_v, ref doc_type_ID)) { long_v doc_type_ID_v = new long_v(doc_type_ID); string_v doc_Description_v = new string_v(doc_Description); if (Get(doc_Name, doc_Description_v, doc, doc_type_ID_v, Compressed, Active, Default, ref doc_ID)) { return true; } } } return false; }
public SampleDB_Price_ShopC_Item( string xShopC_Item_UniqueName, string xShopC_Item_Name, int_v xShopC_Item_Code, string xShopC_Item_ParentGroup1, string xShopC_Item_ParentGroup2, string xShopC_Item_ParentGroup3, string xShopC_Item_Unit_Name, string xShopC_Item_Unit_Symbol, int xShopC_Item_Unit_DecimalPlaces, bool xShopC_Item_Unit_StorageOption, string xShopC_Item_Unit_Description, string xShopC_Item_barcode, string xShopC_Item_Description, int xShopC_Item_Expiry_ExpectedShelfLifeInDays, int xShopC_Item_Expiry_SaleBeforeExpiryDateInDays, int xShopC_Item_Expiry_DiscardBeforeExpiryDateInDays, string xShopC_Item_Expiry_ExpiryDescription, int xShopC_Item_Warranty_WarrantyDuration, int xShopC_Item_Warranty_WarrantyDurationType, string xShopC_Item_Warranty_WarrantyConditions, Image xShopC_Item_Image, bool xShopC_Item_ToOffer, string xShopC_Price_Item_PriceList_Name, bool xShopC_Price_Item_PriceList_valid, string xShopC_Price_Item_Currency_Abbreviation, string xShopC_Price_Item_Currency_Name, string xShopC_Price_Item_Currency_Symbol, int xShopC_Price_Item_CurrencyCode, int xShopC_Price_Item_Currency_DecimalPlaces, DateTime_v xShopC_Price_Item_PriceList_ValidFrom_v, DateTime_v xShopC_Price_Item_PriceList_ValidTo_v, DateTime_v xShopC_Price_Item_PriceList_CreationDate_v, string xShopC_Price_Item_PriceList_Description, string xShopC_Price_Item_TaxationName, decimal xShopC_Price_Item_TaxationRate, decimal xShopC_Price_Item_RetailPricePerUnit, decimal_v xShopC_Price_Item_Discount_v ) { ShopC_Price_Item_RetailPricePerUnit = xShopC_Price_Item_RetailPricePerUnit; ShopC_Price_Item_Discount_v = xShopC_Price_Item_Discount_v; ShopC_Price_Item_TaxationName = xShopC_Price_Item_TaxationName; ShopC_Price_Item_TaxationRate = xShopC_Price_Item_TaxationRate; ShopC_Item_Code = xShopC_Item_Code; ShopC_Item_UniqueName = xShopC_Item_UniqueName; ShopC_Item_Name = xShopC_Item_Name; ShopC_Item_ParentGroup1 = xShopC_Item_ParentGroup1; ShopC_Item_ParentGroup2 = xShopC_Item_ParentGroup2; ShopC_Item_ParentGroup3 = xShopC_Item_ParentGroup3; ShopC_Item_Unit_Name = xShopC_Item_Unit_Name; ShopC_Item_Unit_Symbol = xShopC_Item_Unit_Symbol; ShopC_Item_Unit_DecimalPlaces = xShopC_Item_Unit_DecimalPlaces; ShopC_Item_Unit_StorageOption = xShopC_Item_Unit_StorageOption; ShopC_Item_Unit_Description = xShopC_Item_Unit_Description; ShopC_Item_barcode = xShopC_Item_barcode; ShopC_Item_Description = xShopC_Item_Description; ShopC_Item_Expiry_ExpectedShelfLifeInDays = xShopC_Item_Expiry_ExpectedShelfLifeInDays; ShopC_Item_Expiry_SaleBeforeExpiryDateInDays = xShopC_Item_Expiry_SaleBeforeExpiryDateInDays; ShopC_Item_Expiry_DiscardBeforeExpiryDateInDays = xShopC_Item_Expiry_DiscardBeforeExpiryDateInDays; ShopC_Item_Expiry_ExpiryDescription = xShopC_Item_Expiry_ExpiryDescription; ShopC_Item_Warranty_WarrantyDuration = xShopC_Item_Warranty_WarrantyDuration; ShopC_Item_Warranty_WarrantyDurationType = xShopC_Item_Warranty_WarrantyDurationType; ShopC_Item_Warranty_WarrantyConditions = xShopC_Item_Warranty_WarrantyConditions; ShopC_Item_Image = xShopC_Item_Image; ShopC_Item_ToOffer = xShopC_Item_ToOffer; ShopC_Price_Item_PriceList_Name = xShopC_Price_Item_PriceList_Name; ShopC_Price_Item_PriceList_valid = xShopC_Price_Item_PriceList_valid; ShopC_Price_Item_Currency_Abbreviation = xShopC_Price_Item_Currency_Abbreviation; ShopC_Price_Item_Currency_Name = xShopC_Price_Item_Currency_Name; ShopC_Price_Item_Currency_Symbol = xShopC_Price_Item_Currency_Symbol; ShopC_Price_Item_CurrencyCode = xShopC_Price_Item_CurrencyCode; ShopC_Price_Item_Currency_DecimalPlaces = xShopC_Price_Item_Currency_DecimalPlaces; ShopC_Price_Item_PriceList_ValidFrom_v = xShopC_Price_Item_PriceList_ValidFrom_v; ShopC_Price_Item_PriceList_ValidTo_v = xShopC_Price_Item_PriceList_ValidTo_v; ShopC_Price_Item_PriceList_CreationDate_v = xShopC_Price_Item_PriceList_CreationDate_v; ShopC_Price_Item_PriceList_Description = xShopC_Price_Item_PriceList_Description; }
public void Set(string DocInvoice, DataRow dria, ref List<object> DocInvoice_ShopC_Item_Data_list) { Stock_Data stock_data = null; int i = 0; int iCount = DocInvoice_ShopC_Item_Data_list.Count; Atom_Item_ID = tf.set_long(dria["Atom_Item_ID"]); if (Atom_Item_ID != null) { for (i = 0; i < iCount; i++) { if (((Atom_DocInvoice_ShopC_Item_Price_Stock_Data)DocInvoice_ShopC_Item_Data_list[i]).Atom_Item_ID.v == Atom_Item_ID.v) { stock_data = new Stock_Data(); stock_data.Set(dria); ((Atom_DocInvoice_ShopC_Item_Price_Stock_Data)DocInvoice_ShopC_Item_Data_list[i]).m_ShopShelf_Source.Stock_Data_List.Add(stock_data); return; } } m_ShopShelf_Source.Clear(); DocInvoice_ShopC_Item_ID = tf.set_long(dria[DocInvoice+"_ShopC_Item_ID"]); DocInvoice_ID = tf.set_long(dria[DocInvoice+"_ID"]); Atom_Price_Item_ID = tf.set_long(dria["Atom_Price_Item_ID"]); dQuantity_all = tf.set_decimal(dria["dQuantity"]); RetailPricePerUnit = tf.set_decimal(dria["RetailPricePerUnit"]); Discount = tf.set_decimal(dria["Discount"]); RetailPriceWithDiscount = tf.set_decimal(dria["RetailPriceWithDiscount"]); TaxPrice = tf.set_decimal(dria["TaxPrice"]); ExtraDiscount = tf.set_decimal(dria["ExtraDiscount"]); //dQuantity = tf.set_decimal(dria["dQuantity"]); Atom_Item_UniqueName = tf.set_string(dria["Atom_Item_UniqueName"]); Atom_Item_Name_Name = tf.set_string(dria["Atom_Item_Name_Name"]); Atom_Item_barcode_barcode = tf.set_string(dria["Atom_Item_barcode_barcode"]); Atom_Taxation_Name = tf.set_string(dria["Atom_Taxation_Name"]); Atom_Taxation_Rate = tf.set_decimal(dria["Atom_Taxation_Rate"]); Atom_Item_Description_Description = tf.set_string(dria["Atom_Item_Description_Description"]); Atom_Warranty_ID = tf.set_long(dria["Atom_Warranty_ID"]); Atom_Warranty_WarrantyDurationType = tf.set_short(dria["Atom_Warranty_WarrantyDurationType"]); Atom_Warranty_WarrantyDuration = tf.set_int(dria["Atom_Warranty_WarrantyDuration"]); Atom_Warranty_WarrantyConditions = tf.set_string(dria["Atom_Warranty_WarrantyConditions"]); Atom_Expiry_ID = tf.set_long(dria["Atom_Expiry_ID"]); Atom_Expiry_ExpectedShelfLifeInDays = tf.set_int(dria["Atom_Expiry_ExpectedShelfLifeInDays"]); Atom_Expiry_SaleBeforeExpiryDateInDays = tf.set_int(dria["Atom_Expiry_SaleBeforeExpiryDateInDays"]); Atom_Expiry_DiscardBeforeExpiryDateInDays = tf.set_int(dria["Atom_Expiry_DiscardBeforeExpiryDateInDays"]); Atom_Expiry_ExpiryDescription = tf.set_string(dria["Atom_Expiry_ExpiryDescription"]); Item_ID = tf.set_long(dria["Item_ID"]); Atom_Unit_Name = tf.set_string(dria["Atom_Unit_Name"]); Atom_Unit_Symbol = tf.set_string(dria["Atom_Unit_Symbol"]); Atom_Unit_DecimalPlaces = tf.set_int(dria["Atom_Unit_DecimalPlaces"]); Atom_Unit_Description = tf.set_string(dria["Atom_Unit_Description"]); Atom_Unit_StorageOption = tf.set_bool(dria["Atom_Unit_StorageOption"]); Atom_PriceList_Name = tf.set_string(dria["Atom_PriceList_Name"]); Atom_Currency_Name = tf.set_string(dria["Atom_Currency_Name"]); Atom_Currency_Abbreviation = tf.set_string(dria["Atom_Currency_Abbreviation"]); Atom_Currency_Symbol = tf.set_string(dria["Atom_Currency_Symbol"]); Atom_Currency_DecimalPlaces = tf.set_int(dria["Atom_Currency_DecimalPlaces"]); Atom_Item_Image_Hash = tf.set_string(dria["Atom_Item_Image_Hash"]); Atom_Item_Image_Data = tf.set_byte_array(dria["Atom_Item_Image_Data"]); if (dria["s1_name"] is string) { s1_name = (string)dria["s1_name"]; } if (dria["s2_name"] is string) { s2_name = (string)dria["s2_name"]; } if (dria["s3_name"] is string) { s3_name = (string)dria["s3_name"]; } stock_data = new Stock_Data(); stock_data.Set(dria); m_ShopShelf_Source.Stock_Data_List.Add(stock_data); DocInvoice_ShopC_Item_Data_list.Add(this); } else { LogFile.Error.Show("ERROR:DocInvoice_ShopC_Item_Data:Set(DataRow dria,..):Atom_Item_ID == null"); } }
public void Set(object xusrc_Item, Item_Data xItem_Data,long xDocInvoice_ID, decimal xFactoryQuantity, decimal xStockQuantity, bool b_from_factory) { m_ShopShelf_Source.Clear(); DocInvoice_ShopC_Item_ID = null; DocInvoice_ID = new long_v(); DocInvoice_ID.v = xDocInvoice_ID; Atom_Price_Item_ID = null; // tf.set_long(dria["Atom_Price_Item_ID"]); RetailPricePerUnit = (decimal_v)tf.Copy(xItem_Data.RetailPricePerUnit); //tf.set_decimal(dr[cpis.icol_RetailPricePerUnit]); Discount = (decimal_v)tf.Copy(xItem_Data.Price_Item_Discount); // tf.set_decimal(dr[cpis.icol_Discount]); decimal retail_price_with_discount = 0; RetailPriceWithDiscount = tf.set_decimal(retail_price_with_discount); //$$TODO decimal tax_price = 0; TaxPrice = tf.set_decimal(tax_price); ExtraDiscount = tf.set_decimal(xItem_Data.ExtraDiscount); Atom_Item_UniqueName = (string_v)tf.Copy(xItem_Data.Item_UniqueName);// tf.set_string(dr[cpis.icol_Item_UniqueName]); Atom_Item_Name_Name = (string_v)tf.Copy(xItem_Data.Item_Name);//tf.set_string(dr[cpis.icol_Item_Name]); Atom_Item_barcode_barcode = (string_v)tf.Copy(xItem_Data.Item_barcode);//tf.set_string(dr[cpis.icol_Item_barcode]); Atom_Taxation_Name = (string_v)tf.Copy(xItem_Data.Taxation_Name);//tf.set_string(dr[cpis.icol_Taxation_Name]); Atom_Taxation_Rate = (decimal_v)tf.Copy(xItem_Data.Taxation_Rate);//tf.set_decimal(dr[cpis.icol_Taxation_Rate]); Atom_Item_Description_Description = (string_v)tf.Copy(xItem_Data.Item_Description);//tf.set_string(dr[cpis.icol_Item_Description]); Atom_Warranty_ID = null; //tf.set_long(dria["Atom_Warranty_ID"]); Atom_Warranty_WarrantyDurationType = (short_v)tf.Copy(xItem_Data.Warranty_WarrantyDurationType);//tf.set_short(dr[cpis.icol_Warranty_WarrantyDurationType]); Atom_Warranty_WarrantyDuration = (int_v)tf.Copy(xItem_Data.Warranty_WarrantyDuration);//tf.set_int(dr[cpis.icol_Warranty_WarrantyDuration]); Atom_Warranty_WarrantyConditions = (string_v)tf.Copy(xItem_Data.Warranty_WarrantyConditions);//tf.set_string(dr[cpis.icol_Warranty_WarrantyConditions]); Atom_Expiry_ID = null; //tf.set_long(dr["Atom_Expiry_ID"]); Atom_Expiry_ExpectedShelfLifeInDays = (int_v)tf.Copy(xItem_Data.Expiry_ExpectedShelfLifeInDays);//tf.set_int(dr[cpis.icol_Expiry_ExpectedShelfLifeInDays]); Atom_Expiry_SaleBeforeExpiryDateInDays = (int_v)tf.Copy(xItem_Data.Expiry_SaleBeforeExpiryDateInDays);//tf.set_int(dr[cpis.icol_Expiry_SaleBeforeExpiryDateInDays]); Atom_Expiry_DiscardBeforeExpiryDateInDays = (int_v)tf.Copy(xItem_Data.Expiry_DiscardBeforeExpiryDateInDays);//tf.set_int(dr[cpis.icol_Expiry_DiscardBeforeExpiryDateInDays]); Atom_Expiry_ExpiryDescription = (string_v)tf.Copy(xItem_Data.Expiry_Description);//tf.set_string(dr[cpis.icol_Expiry_ExpiryDescription]); Item_ID = (long_v)tf.Copy(xItem_Data.Item_ID);//tf.set_long(dr["Item_ID"]); Atom_Unit_Name = (string_v)tf.Copy(xItem_Data.Unit_Name);//tf.set_string(dr[cpis.icol_Unit_Name]); Atom_Unit_Symbol = (string_v)tf.Copy(xItem_Data.Unit_Symbol);//tf.set_string(dr[cpis.icol_Unit_Symbol]); Atom_Unit_DecimalPlaces = (int_v)tf.Copy(xItem_Data.Unit_DecimalPlaces);//tf.set_int(dr[cpis.icol_Unit_DecimalPlaces]); Atom_Unit_Description = (string_v)tf.Copy(xItem_Data.Unit_Description);//tf.set_string(dr[cpis.icol_Unit_Description]); Atom_Unit_StorageOption = (bool_v)tf.Copy(xItem_Data.Unit_StorageOption);//tf.set_bool(dr[cpis.icol_Unit_StorageOption]); Atom_PriceList_Name = (string_v)tf.Copy(xItem_Data.PriceList_Name);//tf.set_string(dr[cpis.icol_PriceList_Name]); Atom_Currency_Name = (string_v)tf.Copy(xItem_Data.Currency_Name);// tf.set_string(dr[cpis.icol_Currency_Name]); Atom_Currency_Abbreviation = (string_v)tf.Copy(xItem_Data.Currency_Abbreviation);//tf.set_string(dr[cpis.icol_Currency_Abbreviation]); Atom_Currency_Symbol = (string_v)tf.Copy(xItem_Data.Currency_Symbol);//tf.set_string(dr[cpis.icol_Currency_Symbol]); Atom_Currency_DecimalPlaces = (int_v)tf.Copy(xItem_Data.Currency_DecimalPlaces);//tf.set_int(dr[cpis.icol_Currency_DecimalPlaces]); Atom_Item_Image_Hash = (string_v)tf.Copy(xItem_Data.Item_Image_Image_Hash);//tf.set_string(dr[cpis.icol_Currency_Symbol]); Atom_Item_Image_Data = (byte_array_v)tf.Copy(xItem_Data.Item_Image_Image_Data);//Itemtf.set_byte_array(dr[cpis.icol_Item_Image_Image_Data]); s1_name = xItem_Data.s1_name; s2_name = xItem_Data.s2_name; s3_name = xItem_Data.s3_name; m_ShopShelf_Source.Add_Stock_Data(xItem_Data, xFactoryQuantity, xStockQuantity, b_from_factory); }
public static bool Get(decimal RetailSimpleItemPrice, decimal_v Discount_v, long Taxation_ID, long SimpleItem_ID, long PriceList_ID, ref long Price_SimpleItem_ID) { List<SQL_Parameter> lpar = new List<SQL_Parameter>(); string spar_RetailSimpleItemPrice = "@par_RetailSimpleItemPrice"; SQL_Parameter par_RetailSimpleItemPrice = new SQL_Parameter(spar_RetailSimpleItemPrice, SQL_Parameter.eSQL_Parameter.Decimal, false, RetailSimpleItemPrice); lpar.Add(par_RetailSimpleItemPrice); string scond_RetailSimpleItemPrice = " RetailSimpleItemPrice = " + spar_RetailSimpleItemPrice + " "; string sval_RetailSimpleItemPrice = " " + spar_RetailSimpleItemPrice + " "; string scond_Discount = " Discount is null "; string sval_Discount = " null "; if (Discount_v != null) { string spar_Discount = "@par_Discount"; SQL_Parameter par_Discount = new SQL_Parameter(spar_Discount, SQL_Parameter.eSQL_Parameter.Decimal, false, Discount_v.v); lpar.Add(par_Discount); scond_Discount = " Discount = " + spar_Discount + " "; sval_Discount = " " + spar_Discount + " "; } string sql = "select ID from Price_SimpleItem where " + scond_RetailSimpleItemPrice + " and " + scond_Discount + " and Taxation_ID = " + Taxation_ID.ToString() + " and SimpleItem_ID = " + SimpleItem_ID.ToString() + " and PriceList_ID = " + PriceList_ID.ToString(); DataTable dt = new DataTable(); string Err = null; if (DBSync.DBSync.ReadDataTable(ref dt, sql, lpar, ref Err)) { if (dt.Rows.Count>0) { Price_SimpleItem_ID = (long)dt.Rows[0]["ID"]; return true; } else { sql = @"insert into Price_SimpleItem (RetailSimpleItemPrice, Discount, Taxation_ID, SimpleItem_ID, PriceList_ID ) values (" + sval_RetailSimpleItemPrice + "," + sval_Discount + "," + Taxation_ID.ToString() + "," + SimpleItem_ID.ToString() + "," + PriceList_ID.ToString() + ")"; object oret = null; if (DBSync.DBSync.ExecuteNonQuerySQLReturnID(sql,lpar,ref Price_SimpleItem_ID,ref oret, ref Err, "Price_SimpleItem")) { return true; } else { LogFile.Error.Show("ERROR:f_Price_SimpleItem:Get:sql=" + sql + "\r\nErr=" + Err); return false; } } } else { LogFile.Error.Show("ERROR:f_Price_SimpleItem:Get:sql=" + sql + "\r\nErr=" + Err); return false; } }
public static bool Get(string Name, string_v Description_v, decimal_v Width_v,decimal_v Height_v, ref long doc_page_type_ID) { string Err = null; List<SQL_Parameter> lpar = new List<SQL_Parameter>(); //Table doc_page_type //Table Language string spar_Name = "@par_Name"; SQL_Parameter par_Name = new SQL_Parameter(spar_Name, SQL_Parameter.eSQL_Parameter.Nvarchar, false, Name); lpar.Add(par_Name); string sval_Description = "null"; if (Description_v != null) { string spar_Description = "@par_Description"; SQL_Parameter par_Description = new SQL_Parameter(spar_Description, SQL_Parameter.eSQL_Parameter.Nvarchar, false, Description_v.v); lpar.Add(par_Description); sval_Description = spar_Description; } string spar_Width = "@par_Width"; string sval_Width = "null"; if (Width_v != null) { SQL_Parameter par_Width = new SQL_Parameter(spar_Width, SQL_Parameter.eSQL_Parameter.Decimal, false, Width_v.v); lpar.Add(par_Width); sval_Width = spar_Width; } string spar_Height = "@par_Height"; string sval_Height = "null"; if (Height_v != null) { SQL_Parameter par_Height = new SQL_Parameter(spar_Height, SQL_Parameter.eSQL_Parameter.Decimal, false, Height_v.v); lpar.Add(par_Height); sval_Height = spar_Height; } string sql = "select ID from doc_page_type where Name = " + spar_Name + " and Description = " + sval_Description + " and Width = " + sval_Width + " and Height = " + sval_Height; DataTable dt = new DataTable(); if (DBSync.DBSync.ReadDataTable(ref dt, sql, lpar, ref Err)) { if (dt.Rows.Count > 0) { doc_page_type_ID = (long)dt.Rows[0]["ID"]; return true; } else { sql = "insert into doc_page_type (Name,Description,Width,Height)values(" + spar_Name + "," + sval_Description + "," + sval_Width + "," + sval_Height + ")"; object oret = null; if (DBSync.DBSync.ExecuteNonQuerySQLReturnID(sql, lpar, ref doc_page_type_ID, ref oret, ref Err, "doc_page_type")) { return true; } else { LogFile.Error.Show("ERROR:f_doc_page_type:Get:sql=" + sql + "\r\nErr=" + Err); return false; } } } else { LogFile.Error.Show("ERROR:f_doc_page_type:Get:sql=" + sql + "\r\nErr=" + Err); return false; } }
public static decimal_v set_decimal(object p) { decimal_v x = null; if (p == null) return null; if (p is decimal) { x = new decimal_v((decimal)p); } else if (!(p is System.DBNull)) { tf.ShowTypeError(p.GetType().ToString(),x.GetType().ToString()); } return x; }
public void Set(System.Data.DataRow dria) { Stock_ID = tf.set_long(dria["Stock_ID"]); Stock_ImportTime = tf.set_DateTime(dria["Stock_ImportTime"]); Stock_ExpiryDate = tf.set_DateTime(dria["Stock_ExpiryDate"]); dQuantity = tf.set_decimal(dria["dQuantity"]); }
public decimal_v Clone() { decimal_v o_v = new decimal_v(); o_v.v = this.v; return o_v; }
public static decimal_v Copy(decimal_v o_v) { if (o_v != null) { return o_v.Clone(); } else { return null; } }
public void Set_Price_Item_Stock(DataRow xdr) { Price_Item_ID = tf.set_long(xdr["Price_Item_ID"]); Price_Item_Discount = tf.set_decimal(xdr["Price_Item_Discount"]); PriceList_ID = tf.set_long(xdr["PriceList_ID"]); PriceList_Name = tf.set_string(xdr["PriceList_Name"]); Currency_Name = tf.set_string(xdr["Currency_Name"]); ; Currency_Abbreviation = tf.set_string(xdr["Currency_Abbreviation"]); Currency_Symbol = tf.set_string(xdr["Currency_Symbol"]); Currency_DecimalPlaces = tf.set_int(xdr["Currency_DecimalPlaces"]); Stock_ID = tf.set_long(xdr["Stock_ID"]); Stock_ExpiryDate = tf.set_DateTime(xdr["Stock_ExpiryDate"]); Stock_dQuantity = tf.set_decimal(xdr["Stock_dQuantity"]); RetailPricePerUnit = tf.set_decimal(xdr["RetailPricePerUnit"]); Stock_ImportTime = tf.set_DateTime(xdr["Stock_ImportTime"]); Item_ID = tf.set_long(xdr["Item_ID"]); Item_UniqueName = tf.set_string(xdr["Item_UniqueName"]); Item_Name = tf.set_string(xdr["Item_Name"]); Item_barcode = tf.set_string(xdr["Item_barcode"]); Item_Image_ID = tf.set_long(xdr["Item_Image_ID"]); Item_Image_Image_Data = tf.set_byte_array(xdr["Item_Image_Image_Data"]); Item_Image_Image_Hash = tf.set_string(xdr["Item_Image_Image_Hash"]); Item_Description = tf.set_string(xdr["Item_Description"]); Unit_Name = tf.set_string(xdr["Unit_Name"]); Unit_Symbol = tf.set_string(xdr["Unit_Symbol"]); Unit_DecimalPlaces = tf.set_int(xdr["Unit_DecimalPlaces"]); Unit_StorageOption = tf.set_bool(xdr["Unit_StorageOption"]); Unit_Description = tf.set_string(xdr["Unit_Description"]); Expiry_ID = tf.set_long(xdr["Expiry_ID"]); Unit_Name = tf.set_string(xdr["Unit_Name"]); Expiry_ExpectedShelfLifeInDays = tf.set_int(xdr["Expiry_ExpectedShelfLifeInDays"]); Expiry_SaleBeforeExpiryDateInDays = tf.set_int(xdr["Expiry_SaleBeforeExpiryDateInDays"]); Expiry_DiscardBeforeExpiryDateInDays = tf.set_int(xdr["Expiry_DiscardBeforeExpiryDateInDays"]); Expiry_Description = tf.set_string(xdr["Expiry_ExpiryDescription"]); Item_Expiry_ID = tf.set_long(xdr["Expiry_ID"]); Item_ToOffer = tf.set_bool(xdr["Item_ToOffer"]); Item_Warranty_ID = tf.set_long(xdr["Warranty_ID"]); Warranty_ID = tf.set_long(xdr["Warranty_ID"]); Warranty_WarrantyConditions = tf.set_string(xdr["Warranty_WarrantyConditions"]); Warranty_WarrantyDuration = tf.set_int(xdr["Warranty_WarrantyDuration"]); Warranty_WarrantyDurationType = tf.set_short(fs.MyConvertToShort(xdr["Warranty_WarrantyDurationType"])); Taxation_ID = tf.set_long(xdr["Taxation_ID"]); Taxation_Name = tf.set_string(xdr["Taxation_Name"]); Taxation_Rate = tf.set_decimal(xdr["Taxation_Rate"]); PurchasePricePerUnit = tf.set_decimal(xdr["PurchasePricePerUnit"]); PurchaseOrganisation_Name = tf.set_string(xdr["PurchaseOrganisation_Name"]); PurchaseOrganisation_Address.StreetName_v = tf.set_dstring(xdr["StreetName"]); PurchaseOrganisation_Address.HouseNumber_v = tf.set_dstring(xdr["HouseNumber"]); PurchaseOrganisation_Address.City_v = tf.set_dstring(xdr["City"]); PurchaseOrganisation_Address.ZIP_v = tf.set_dstring(xdr["ZIP"]); PurchaseOrganisation_Address.Country_v = tf.set_dstring(xdr["Country"]); if (xdr["s1_name"] is string) { s1_name = (string)xdr["s1_name"]; } if (xdr["s2_name"] is string) { s2_name = (string)xdr["s2_name"]; } if (xdr["s3_name"] is string) { s3_name = (string)xdr["s3_name"]; } }
public static bool Get(decimal RetailSimpleItemPrice, decimal_v Discount_v, string TaxationName, decimal TaxationRate, string SimpleItem_Name, string Abbreviation, bool bToOffer, Image SimpleItem_Image, int_v Code_v, string SimpleItem_ParentGroup1, string SimpleItem_ParentGroup2, string SimpleItem_ParentGroup3, string sPriceListName, bool valid, string Currency_Abbreviation, string Currency_Name, string Currency_Symbol, int CurrencyCode, int Currency_DecimalPlaces, DateTime_v ValidFrom_v, DateTime_v ValidTo_v, DateTime_v CreationDate_v, string Description, ref long Currency_ID, ref long SimpleItem_ID, ref long Taxation_ID, ref long PriceList_ID, ref long Price_SimpleItem_ID) { if (f_Taxation.Get(TaxationName, TaxationRate,ref Taxation_ID)) { if (f_Currency.Get(Currency_Abbreviation, Currency_Name, Currency_Symbol, CurrencyCode, Currency_DecimalPlaces, ref Currency_ID)) { if (f_SimpleItem.Get(SimpleItem_Name, Abbreviation, bToOffer, SimpleItem_Image, Code_v, SimpleItem_ParentGroup1, SimpleItem_ParentGroup2, SimpleItem_ParentGroup3, ref SimpleItem_ID)) { if (f_PriceList.Get(sPriceListName, valid, Currency_ID, ValidFrom_v, ValidTo_v, CreationDate_v, Description, ref PriceList_ID)) { if (Get(RetailSimpleItemPrice, Discount_v, Taxation_ID, SimpleItem_ID, PriceList_ID, ref Price_SimpleItem_ID)) { return true; } } } } } return false; }
public void set(object o) { this.type_v = null; if (o == null) return; if (o is decimal) { this.type_v = new decimal_v((decimal)o); } else if (o is System.DBNull) { return; } else { LogFile.Error.Show("ERROR:DB_Types:set:WRONG TYPE:" + o.GetType().ToString() + " should be " + this.GetType().ToString()); } }
private bool Get_Atom_Taxation_ID(string_v Taxation_Name, decimal_v Taxation_Rate, ref long Atom_Taxation_ID) { string Err = null; if ((Taxation_Name != null) && (Taxation_Rate != null)) { List<DBConnectionControl40.SQL_Parameter> lpar = new List<DBConnectionControl40.SQL_Parameter>(); string spar_Taxation_Name = "@par_Taxation_Name"; DBConnectionControl40.SQL_Parameter par_Taxation_Name = new DBConnectionControl40.SQL_Parameter(spar_Taxation_Name, DBConnectionControl40.SQL_Parameter.eSQL_Parameter.Varchar, false, Taxation_Name.v); lpar.Add(par_Taxation_Name); string spar_Taxation_Rate = "@par_Taxation_Rate"; DBConnectionControl40.SQL_Parameter par_Taxation_Rate = new DBConnectionControl40.SQL_Parameter(spar_Taxation_Rate, DBConnectionControl40.SQL_Parameter.eSQL_Parameter.Decimal, false, Taxation_Rate.v); lpar.Add(par_Taxation_Rate); string sql_select_Atom_Item_barcode_ID = @"select ID as Atom_Taxation_ID from Atom_Taxation where Name = " + spar_Taxation_Name + " and Rate = " + spar_Taxation_Rate; DataTable dt = new DataTable(); if (DBSync.DBSync.ReadDataTable(ref dt, sql_select_Atom_Item_barcode_ID, lpar, ref Err)) { if (dt.Rows.Count > 0) { Atom_Taxation_ID = (long)dt.Rows[0]["Atom_Taxation_ID"]; return true; } else { string sql_Insert_Atom_Item_Taxation = @"insert into Atom_Taxation (Name,Rate)values(" + spar_Taxation_Name + "," + spar_Taxation_Rate + ")"; object objret = null; if (DBSync.DBSync.ExecuteNonQuerySQLReturnID(sql_Insert_Atom_Item_Taxation, lpar, ref Atom_Taxation_ID, ref objret, ref Err, DBtcn.stbl_Atom_Taxation_TableName)) { return true; } else { LogFile.Error.Show("ERROR:Get_Atom_Item_Taxation:insert into Atom_Taxation failed!\r\nErr=" + Err); return false; } } } else { LogFile.Error.Show("ERROR:Get_Atom_Item_Taxation:select ID as Atom_Taxation_ID from Atom_Taxation failed!\r\nErr=" + Err); return false; } } else { Err = "ERROR:Get_Atom_Item_Taxation:Taxation_Name can not be null!"; LogFile.Error.Show(Err); return false; } }
public static bool Get(decimal RetailPricePerUnit, decimal_v Discount_v, string TaxationName, decimal TaxationRate, string Item_Name, string UniqueName, bool bToOffer, Image Item_Image, int_v Code_v, string Unit_Name, string Unit_Symbol, int Unit_DecimalPlaces, bool Unit_StorageOption, string Unit_Description, string barcode, string Item_Description, f_Expiry.Expiry_v Expiry_v, f_Warranty.Warranty_v Warranty_v, string Item_ParentGroup1, string Item_ParentGroup2, string Item_ParentGroup3, string sPriceListName, bool valid, string Currency_Abbreviation, string Currency_Name, string Currency_Symbol, int CurrencyCode, int Currency_DecimalPlaces, DateTime_v ValidFrom_v, DateTime_v ValidTo_v, DateTime_v CreationDate_v, string PriceList_Description, ref long Unit_ID, ref long Currency_ID, ref long Item_ID, ref long Taxation_ID, ref long PriceList_ID, ref long Price_Item_ID) { if (f_Taxation.Get(TaxationName, TaxationRate, ref Taxation_ID)) { if (f_Currency.Get(Currency_Abbreviation, Currency_Name, Currency_Symbol, CurrencyCode, Currency_DecimalPlaces, ref Currency_ID)) { if (f_Item.Get(Item_Name, UniqueName, bToOffer, Item_Image, Code_v, Unit_Name,Unit_Symbol,Unit_DecimalPlaces,Unit_StorageOption,Unit_Description,barcode, Item_Description, Expiry_v, Warranty_v, Item_ParentGroup1, Item_ParentGroup2, Item_ParentGroup3,ref Unit_ID, ref Item_ID)) { if (f_PriceList.Get(sPriceListName, valid, Currency_ID, ValidFrom_v, ValidTo_v, CreationDate_v, PriceList_Description, ref PriceList_ID)) { if (Get(RetailPricePerUnit, Discount_v, Taxation_ID, Item_ID, PriceList_ID, ref Price_Item_ID)) { return true; } } } } } return false; }