public bool Get(long_v xOffice_Data_ID_v)
        {
            string Err = null;
            ID_v = null;
            Office_Data_ID_v = null;
            BuildingNumber_v = null;
            BuildingSectionNumber_v = null;
            Community_v = null;
            CadastralNumber_v = null;
            ValidityDate_v = null;
            ClosingTag_v = null;
            SoftwareSupplier_TaxNumber_v = null;
            PremiseType_v = null;

            if (xOffice_Data_ID_v != null)
            {
                string sql = @"SELECT
                                    ID,
                                    Office_Data_ID,
                                    BuildingNumber,
                                    BuildingSectionNumber,
                                    Community,
                                    CadastralNumber,
                                    ValidityDate,
                                    ClosingTag,
                                    SoftwareSupplier_TaxNumber,
                                    PremiseType
                              FROM FVI_SLO_RealEstateBP
                              where Office_Data_ID = " + xOffice_Data_ID_v.v.ToString();
                DataTable dt = new DataTable();
                if (DBSync.DBSync.ReadDataTable(ref dt, sql, ref Err))
                {
                    if (dt.Rows.Count > 0)
                    {
                        ID_v = tf.set_long(dt.Rows[0]["ID"]);
                        Office_Data_ID_v = tf.set_long(dt.Rows[0]["Office_Data_ID"]);
                        BuildingNumber_v = tf.set_int(dt.Rows[0]["BuildingNumber"]);
                        BuildingSectionNumber_v = tf.set_int(dt.Rows[0]["BuildingSectionNumber"]);
                        Community_v = tf.set_string(dt.Rows[0]["Community"]);
                        CadastralNumber_v = tf.set_int(dt.Rows[0]["CadastralNumber"]);
                        ValidityDate_v = tf.set_DateTime(dt.Rows[0]["ValidityDate"]);
                        ClosingTag_v = tf.set_string(dt.Rows[0]["ClosingTag"]);
                        SoftwareSupplier_TaxNumber_v = tf.set_string(dt.Rows[0]["SoftwareSupplier_TaxNumber"]);
                        PremiseType_v = tf.set_string(dt.Rows[0]["PremiseType"]);
                    }
                    return true;
                }
                else
                {
                    LogFile.Error.Show("ERROR:myOrg_Office:Get:sql=" + sql + "\r\nErr=" + Err);
                    return false;
                }
            }
            else
            {
                LogFile.Error.Show("ERROR:myOrg_Office:Get:(Office_ID_v == null)");
                return false;
            }
        }
 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;
 }
示例#3
0
        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);
        }
示例#4
0
        public static bool Get(string 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 Description, 
                               f_Expiry.Expiry_v Expiry_v,
                               f_Warranty.Warranty_v Warranty_v,
                               string Item_ParentGroup1, 
                               string Item_ParentGroup2, 
                               string Item_ParentGroup3,
                               ref long Unit_ID,
                               ref long Item_ID)
        {
            string Err = null;
            DataTable dt = new DataTable();
            string sql = null;
            object oret = null;
            List<SQL_Parameter> lpar = new List<SQL_Parameter>();
            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 spar_UniqueName = "@par_UniqueName";
            SQL_Parameter par_UniqueName = new SQL_Parameter(spar_UniqueName, SQL_Parameter.eSQL_Parameter.Nvarchar, false, UniqueName);
            lpar.Add(par_UniqueName);
            string spar_ToOffer = "@par_ToOffer";
            SQL_Parameter par_ToOffer = new SQL_Parameter(spar_ToOffer, SQL_Parameter.eSQL_Parameter.Bit, false, bToOffer);
            lpar.Add(par_ToOffer);

            string scond_barcode = " barcode is null ";
            string sval_barcode = "null";
            if (barcode!=null)
            {
                string spar_Barcode = "@par_Barcode";
                SQL_Parameter par_Barcode = new SQL_Parameter(spar_Barcode, SQL_Parameter.eSQL_Parameter.Nvarchar, false, barcode);
                lpar.Add(par_Barcode);
                scond_barcode = " barcode = " + spar_Barcode +" ";
                sval_barcode = " " + spar_Barcode + " ";
            }

            string scond_Description = " Description is null ";
            string sval_Description = "null";
            if (Description != null)
            {
                string spar_Description = "@par_Description";
                SQL_Parameter par_Barcode = new SQL_Parameter(spar_Description, SQL_Parameter.eSQL_Parameter.Nvarchar, false, Description);
                lpar.Add(par_Barcode);
                scond_Description = " Description = " + spar_Description + " ";
                sval_Description = " " + spar_Description + " ";
            }

            string scond_Code = " Code is null ";
            string sval_Code = "null";
            if (Code_v != null)
            {
                scond_Code = " Code = " + Code_v.v.ToString() + " ";
                sval_Code = " " + Code_v.v.ToString() + " ";
            }

            long_v Expiry_ID_v = null;
            if (!f_Expiry.Get(Expiry_v,ref Expiry_ID_v))
            {
                return false;
            }
            string scond_Expiry_ID = " Expiry_ID is null ";
            string sval_Expiry_ID = "null";

            if (Expiry_ID_v != null)
            {
                scond_Expiry_ID = " Expiry_ID = " + Expiry_ID_v.v.ToString() + " ";
                sval_Expiry_ID = " " + Expiry_ID_v.v.ToString() + " ";
            }

            long_v Warranty_ID_v = null;
            if (!f_Warranty.Get(Warranty_v, ref Warranty_ID_v))
            {
                return false;
            }

            string scond_Warranty_ID = " Warranty_ID is null ";
            string sval_Warranty_ID = "null";
            if (Warranty_ID_v != null)
            {
                scond_Warranty_ID = " Warranty_ID = " + Warranty_ID_v.v.ToString() + " ";
                sval_Warranty_ID = " " + Warranty_ID_v.v.ToString() + " ";
            }

            string scond_Item_ParentGroup1_ID = " Item_ParentGroup1_ID is null ";
            string sval_Item_ParentGroup1_ID = " null ";

            string scond_Item_Image_ID = " Item_Image_ID is null ";
            string sval_Item_Image_ID = " null ";

            if (!f_Unit.Get(Unit_Name,Unit_Symbol,Unit_DecimalPlaces,Unit_StorageOption,Unit_Description,ref Unit_ID))
            {
                return false;
            }

            if (Item_ParentGroup1 != null)
            {
                long Item_ParentGroup1_ID = -1;
                long Item_Image_ID = -1;
                if (f_Item_ParentGroup1.Get(Item_ParentGroup1, Item_ParentGroup2, Item_ParentGroup3, ref Item_ParentGroup1_ID))
                {
                    scond_Item_ParentGroup1_ID = " Item_ParentGroup1_ID = " + Item_ParentGroup1_ID.ToString() + " ";
                    sval_Item_ParentGroup1_ID = " " + Item_ParentGroup1_ID.ToString() + " ";

                    if (Item_Image != null)
                    {
                        if (f_Item_Image.Get(Item_Image, ref Item_Image_ID))
                        {
                            scond_Item_Image_ID = " Item_Image_ID = " + Item_Image_ID.ToString() + " ";
                            sval_Item_Image_ID = " " + Item_Image.ToString() + " ";
                        }
                        else
                        {
                            return false;
                        }
                    }
                }
            }

            //sql = "select ID from Item where Name = " + spar_Name + " and UniqueName = " + spar_UniqueName + " and ToOffer = " + spar_ToOffer + " and " + scond_Code + " and " + scond_Item_ParentGroup1_ID + " and " + scond_Item_Image_ID;
            sql = "select ID from Item where UniqueName = " + spar_UniqueName;
            if (DBSync.DBSync.ReadDataTable(ref dt, sql, lpar, ref Err))
            {
                if (dt.Rows.Count > 0)
                {
                    Item_ID = (long)dt.Rows[0]["ID"];
                    sql = "select ID from Item where Name = " + spar_Name +
                                            " and UniqueName = " + spar_UniqueName +
                                            " and ToOffer = " + spar_ToOffer +
                                            " and " + scond_Code +
                                            " and " + scond_Item_ParentGroup1_ID +
                                            " and " + scond_Item_Image_ID +
                                            " and Unit_ID = " + Unit_ID.ToString() +
                                            " and " + scond_barcode +
                                            " and " + scond_Description +
                                            " and " + scond_Expiry_ID +
                                            " and " + scond_Warranty_ID;
                    dt.Clear();
                    dt.Rows.Clear();
                    dt.Columns.Clear();
                    if (DBSync.DBSync.ReadDataTable(ref dt, sql, lpar, ref Err))
                    {
                        if (dt.Rows.Count > 0)
                        {
                            return true;
                        }
                        else
                        {
                            sql = @"update Item set Name = " + spar_Name + @",
                                                    ToOffer = " + spar_ToOffer + @",
                                                    Code = " + sval_Code + @",
                                                    Item_ParentGroup1_ID = " + sval_Item_ParentGroup1_ID + @",
                                                    Item_Image_ID = " + sval_Item_Image_ID + @",
                                                    Unit_ID = " + Unit_ID.ToString() + @",
                                                    barcode = " + sval_barcode + @",
                                                    Description = " + sval_Description + @",
                                                    Expiry_ID = " + sval_Expiry_ID + @",
                                                    Warranty_ID = " + sval_Warranty_ID + " where ID = " + Item_ID.ToString();
                            if (DBSync.DBSync.ExecuteNonQuerySQL(sql, lpar, ref oret, ref Err))
                            {
                                return true;
                            }
                            else
                            {
                                LogFile.Error.Show("ERROR:f_Item:Get:sql=" + sql + "\r\nErr=" + Err);
                                return false;
                            }
                        }
                    }
                    else
                    {
                        LogFile.Error.Show("ERROR:f_Item:Get:sql=" + sql + "\r\nErr=" + Err);
                        return false;
                    }
                }
                else
                {
                    sql = @"insert into Item (Name,
                                              UniqueName,
                                              ToOffer,
                                              Code,
                                              Item_ParentGroup1_ID,
                                              Item_Image_ID,
                                              Unit_ID,
                                              barcode,
                                              Description,
                                              Expiry_ID,
                                              Warranty_ID
                                              )values("
                                            + spar_Name + ","
                                            + spar_UniqueName + ","
                                            + spar_ToOffer + ","
                                            + sval_Code + ","
                                            + sval_Item_ParentGroup1_ID + ","
                                            + sval_Item_Image_ID + ","
                                            + Unit_ID.ToString() + ","
                                            + sval_barcode + ","
                                            + sval_Description + ","
                                            + sval_Expiry_ID + ","
                                            + sval_Warranty_ID +
                                            ")";
                    if (DBSync.DBSync.ExecuteNonQuerySQLReturnID(sql, lpar, ref Item_ID, ref oret, ref Err, "Item"))
                    {
                        return true;
                    }
                    else
                    {
                        LogFile.Error.Show("ERROR:f_Item:Get:sql=" + sql + "\r\nErr=" + Err);
                        return false;
                    }
                }
            }
            else
            {
                LogFile.Error.Show("ERROR:f_Item:Get:sql=" + sql + "\r\nErr=" + Err);
                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");
            }
        }
示例#7
0
 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;
 }
示例#8
0
        public bool Storno(ref long Storno_DocInvoice_ID,  bool bStorno, string sReason,ref  DateTime retissue_time)
        {
            object ores = null;
            string Err = null;
            DataTable dt_ProfInv = new DataTable();
            string sql = @"select
                        Draft,
                        DraftNumber,
                        FinancialYear,
                        NumberInFinancialYear,
                        NetSum,
                        Discount,
                        EndSum,
                        TaxSum,
                        GrossSum,
                        Atom_Customer_Person_ID,
                        Atom_Customer_Org_ID,
                        WarrantyExist,
                        WarrantyConditions,
                        WarrantyDurationType,
                        WarrantyDuration,
                        DocDuration,
                        DocDurationType,
                        TermsOfPayment_ID,
                        PaymentDeadline,
                        MethodOfPayment_ID
                        Paid,
                        Storno,
                        Invoice_Reference_ID,
                        Invoice_Reference_Type from DocInvoice where DocInvoice.ID  = " + Doc_ID.ToString();
            if (DBSync.DBSync.ReadDataTable(ref dt_ProfInv, sql, ref Err))
            {
                int_v DraftNumber_v = tf.set_int(dt_ProfInv.Rows[0]["DraftNumber"]);
                int_v FinancialYear_v = tf.set_int(dt_ProfInv.Rows[0]["FinancialYear"]);
                decimal_v NetSum_v = tf.set_decimal(dt_ProfInv.Rows[0]["NetSum"]);
                decimal_v Discount_v = tf.set_decimal(dt_ProfInv.Rows[0]["Discount"]);
                decimal_v EndSum_v = tf.set_decimal(dt_ProfInv.Rows[0]["EndSum"]);
                decimal_v TaxSum_v = tf.set_decimal(dt_ProfInv.Rows[0]["TaxSum"]);
                decimal_v GrossSum_v = tf.set_decimal(dt_ProfInv.Rows[0]["GrossSum"]);
                long_v Atom_Customer_Person_ID_v = tf.set_long(dt_ProfInv.Rows[0]["Atom_Customer_Person_ID"]);
                long_v Atom_Customer_Org_ID_v = tf.set_long(dt_ProfInv.Rows[0]["Atom_Customer_Org_ID"]);
                bool_v WarrantyExist_v = tf.set_bool(dt_ProfInv.Rows[0]["WarrantyExist"]);
                string_v WarrantyConditions_v = tf.set_string(dt_ProfInv.Rows[0]["WarrantyConditions"]);
                int_v WarrantyDurationType_v = tf.set_int(dt_ProfInv.Rows[0]["WarrantyDurationType"]);
                int_v WarrantyDuration_v = tf.set_int(dt_ProfInv.Rows[0]["WarrantyDuration"]);
                long_v DocDuration_v = tf.set_long(dt_ProfInv.Rows[0]["DocDuration"]);
                int_v DocDurationType_v = tf.set_int(dt_ProfInv.Rows[0]["DocDurationType"]);
                long_v TermsOfPayment_ID_v = tf.set_long(dt_ProfInv.Rows[0]["TermsOfPayment_ID"]);
                int iNewNumberInFinancialYear = -1;
                GetNewNumberInFinancialYear(ref iNewNumberInFinancialYear);
                int_v iNewNumberInFinancialYear_v = new int_v(iNewNumberInFinancialYear);

                long_v Storno_Invoice_ID_v = new long_v(Doc_ID);

                NetSum_v.v = -NetSum_v.v;
                TaxSum_v.v = -TaxSum_v.v;
                GrossSum_v.v = -GrossSum_v.v;

                List<SQL_Parameter> lpar = new List<SQL_Parameter>();
                sql = @"insert into DocInvoice (
                                                Draft,
                                                DraftNumber,
                                                FinancialYear,
                                                NumberInFinancialYear,
                                                NetSum,
                                                Discount,
                                                EndSum,
                                                TaxSum,
                                                GrossSum,
                                                Atom_Customer_Person_ID,
                                                Atom_Customer_Org_ID,
                                                WarrantyExist,
                                                WarrantyConditions,
                                                WarrantyDurationType,
                                                WarrantyDuration,
                                                DocDuration,
                                                DocDurationType,
                                                TermsOfPayment_ID,
                                                Invoice_Reference_ID,
                                                Storno,
                                                Invoice_Reference_Type
                                                )
                                                values
                                                (
                                                    0,"
                                                            + GetParam("DraftNumber", ref lpar, DraftNumber_v) + ","
                                                            + GetParam("FinancialYear", ref lpar, FinancialYear_v) + ","
                                                            + GetParam("NumberInFinancialYear", ref lpar, iNewNumberInFinancialYear_v) + ","
                                                            + GetParam("NetSum", ref lpar, NetSum_v) + ","
                                                            + GetParam("Discount", ref lpar, Discount_v) + ","
                                                            + GetParam("EndSum", ref lpar, EndSum_v) + ","
                                                            + GetParam("TaxSum", ref lpar, TaxSum_v) + ","
                                                            + GetParam("GrossSum", ref lpar, GrossSum_v) + ","
                                                            + GetParam("Atom_Customer_Person_ID", ref lpar, Atom_Customer_Person_ID_v) + ","
                                                            + GetParam("Atom_Customer_Org_ID", ref lpar, Atom_Customer_Org_ID_v) + ","
                                                            + GetParam("WarrantyExist", ref lpar, WarrantyExist_v) + ","
                                                            + GetParam("WarrantyConditions", ref lpar, WarrantyConditions_v) + ","
                                                            + GetParam("WarrantyDurationType", ref lpar, WarrantyDurationType_v) + ","
                                                            + GetParam("WarrantyDuration", ref lpar, WarrantyDuration_v) + ","
                                                            + GetParam("DocDuration", ref lpar, DocDuration_v) + ","
                                                            + GetParam("DocDurationType", ref lpar, DocDurationType_v) + ","
                                                            + GetParam("TermsOfPayment_ID", ref lpar, TermsOfPayment_ID_v) + ","
                                                            + GetParam("Invoice_Reference_ID", ref lpar, Storno_Invoice_ID_v) + @",
                                                            1,
                                                            'STORNO'
                                                            )";

                        if (DBSync.DBSync.ExecuteNonQuerySQLReturnID(sql, lpar, ref Storno_DocInvoice_ID, ref ores, ref Err, "DocInvoice"))
                        {
                            string sBit = "0";
                            if (bStorno)
                            {
                                sBit = "1";
                            }
                            sql = " update Docinvoice set Storno  = " + sBit + @",
                                                   Invoice_Reference_ID = " + Storno_DocInvoice_ID.ToString() + @",
                                                   Invoice_Reference_Type = 'STORNO' where ID = " + this.Doc_ID.ToString();

                        if (DBSync.DBSync.ExecuteNonQuerySQL(sql, null, ref ores, ref Err))
                        {
                            long Journal_DocInvoice_ID = -1;
                            DateTime_v issue_time = new DateTime_v(DateTime.Now);

                            retissue_time = issue_time.v;

                            if (f_Journal_DocInvoice.Write(Storno_DocInvoice_ID, GlobalData.Atom_WorkPeriod_ID, GlobalData.JOURNAL_DocInvoice_Type_definitions.InvoiceStornoTime.ID, issue_time, ref Journal_DocInvoice_ID))
                            {
                                  return true;
                            }
                            return false;
                        }
                        else
                        {
                            LogFile.Error.Show("ERROR:CurrentInvoice:Storno:sql=" + sql + "\r\nErr=" + Err);
                            return false;
                        }
                    }
                    else
                    {
                        LogFile.Error.Show("ERROR:CurrentInvoice:Storno:sql=" + sql + "\r\nErr=" + Err);
                        return false;
                    }
                }
                else
                {
                    LogFile.Error.Show("ERROR:CurrentInvoice:Storno:sql=" + sql + "\r\nErr=" + Err);
                    return false;
                }
        }
示例#9
0
文件: tf.cs 项目: dstrucl/Tangenta40
 public static int_v set_int(object p)
 {
     int_v x = null;
     if (p == null) return null;
     if (p is int)
     {
         x = new int_v((int)p);
     }
     else if (p is uint)
     {
         x = new int_v((uint)p);
     }
     else if (p is ushort)
     {
         x = new int_v((uint)p);
     }
     else if (p is short)
     {
         x = new int_v((uint)p);
     }
     else if (!(p is System.DBNull))
     {
         tf.ShowTypeError(p.GetType().ToString(),x.GetType().ToString());
     }
     return x;
 }
示例#10
0
        public static bool Get(string Name, string Abbreviation, bool bToOffer, Image SimpleItem_Image, int_v Code_v, string SimpleItem_ParentGroup1, string SimpleItem_ParentGroup2, string SimpleItem_ParentGroup3, ref long SimpleItem_ID)
        {
            string Err = null;
            DataTable dt = new DataTable();
            string sql = null;
            object oret = null;
            List<SQL_Parameter> lpar = new List<SQL_Parameter>();
            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 spar_Abbreviation = "@par_Abbreviation";
            SQL_Parameter par_Abbreviation = new SQL_Parameter(spar_Abbreviation, SQL_Parameter.eSQL_Parameter.Nvarchar, false, Abbreviation);
            lpar.Add(par_Abbreviation);
            string spar_ToOffer = "@par_ToOffer";
            SQL_Parameter par_ToOffer = new SQL_Parameter(spar_ToOffer, SQL_Parameter.eSQL_Parameter.Bit, false, bToOffer);
            lpar.Add(par_ToOffer);

            string scond_Code = " Code is null ";
            string sval_Code = "null";
            if (Code_v != null)
            {
                scond_Code = " Code = " + Code_v.v.ToString() + " ";
                sval_Code = " " + Code_v.v.ToString() + " ";
            }

            string scond_SimpleItem_ParentGroup1_ID = " SimpleItem_ParentGroup1_ID is null ";
            string sval_SimpleItem_ParentGroup1_ID = " null ";

            string scond_SimpleItem_Image_ID = " SimpleItem_Image_ID is null ";
            string sval_SimpleItem_Image_ID = " null ";

            if (SimpleItem_ParentGroup1 != null)
            {
                long SimpleItem_ParentGroup1_ID = -1;
                long SimpleItem_Image_ID = -1;
                if (f_SimpleItem_ParentGroup1.Get(SimpleItem_ParentGroup1, SimpleItem_ParentGroup2, SimpleItem_ParentGroup3, ref SimpleItem_ParentGroup1_ID))
                {
                    scond_SimpleItem_ParentGroup1_ID = " SimpleItem_ParentGroup1_ID = " + SimpleItem_ParentGroup1_ID.ToString() + " ";
                    sval_SimpleItem_ParentGroup1_ID = " " + SimpleItem_ParentGroup1_ID.ToString() + " ";

                    if (SimpleItem_Image!=null)
                    {
                        if (f_SimpleItem_Image.Get(SimpleItem_Image, ref SimpleItem_Image_ID))
                        {
                            scond_SimpleItem_Image_ID = " SimpleItem_Image_ID = " + SimpleItem_Image_ID.ToString() + " ";
                            sval_SimpleItem_Image_ID = " " + SimpleItem_Image_ID.ToString() + " ";
                        }
                        else
                        {
                            return false;
                        }
                    }
                }
            }
            sql = "select ID from SimpleItem where Name = " + spar_Name + " and Abbreviation = " + spar_Abbreviation + " and ToOffer = " + spar_ToOffer + " and " + scond_Code + " and " + scond_SimpleItem_ParentGroup1_ID + " and " + scond_SimpleItem_Image_ID;
            if (DBSync.DBSync.ReadDataTable(ref dt, sql, lpar, ref Err))
            {
                if (dt.Rows.Count > 0)
                {
                    SimpleItem_ID = (long)dt.Rows[0]["ID"];
                    return true;
                }
                else
                {
                    sql = "insert into SimpleItem (Name,Abbreviation,ToOffer,Code,SimpleItem_ParentGroup1_ID,SimpleItem_Image_ID)values(" + spar_Name + "," + spar_Abbreviation + ",1," + sval_Code + "," + sval_SimpleItem_ParentGroup1_ID + "," + sval_SimpleItem_Image_ID + ")";
                    if (DBSync.DBSync.ExecuteNonQuerySQLReturnID(sql, lpar, ref SimpleItem_ID, ref oret, ref Err, "SimpleItem"))
                    {
                        return true;
                    }
                    else
                    {
                        LogFile.Error.Show("ERROR:f_SimpleItem:Get:sql=" + sql + "\r\nErr=" + Err);
                        return false;
                    }
                }
            }
            else
            {
                LogFile.Error.Show("ERROR:f_SimpleItem:Get:sql=" + sql + "\r\nErr=" + Err);
                return false;
            }
        }
示例#11
0
文件: fs.cs 项目: dstrucl/Tangenta40
        public static decimal GetIncrement(int_v DecimalPlaces, string_v Unit_Symbol)
        {
            if (DecimalPlaces != null)
            {
                try
                {
                    if (Unit_Symbol == null)
                    {
                        double y = -DecimalPlaces.v;
                        decimal dincrement = (decimal)Math.Pow(10, y);
                        return dincrement;
                    }
                    else
                    {
                        if (Unit_Symbol.v.Equals("kom."))
                        {
                            return 1;
                        }
                        else
                        {
                            double y = -DecimalPlaces.v;
                            decimal dincrement = (decimal)Math.Pow(10, y);
                            return dincrement;
                        }
                    }

                }
                catch
                {
                    return 1M;
                }
            }
            else
            {
                return 1M;
            }
        }
示例#12
0
 public int_v Clone()
 {
     int_v i_v = new int_v();
     i_v.bUnsigned = this.bUnsigned;
     i_v.v_ = this.v_;
     i_v.uv_ = this.uv_;
     return i_v;
 }
示例#13
0
 public static int_v Copy(int_v o_v)
 {
     if (o_v != null)
     {
         return o_v.Clone();
     }
     else
     {
         return null;
     }
 }
示例#14
0
 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"];
     }
 }
示例#15
0
 public void set(object o)
 {
     this.type_v = null;
     if (o == null) return;
     if (o is int)
     {
         this.type_v = new int_v((int)o);
     }
     else if (o is uint)
     {
         this.type_v = new int_v((uint)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());
     }
 }
示例#16
0
        bool Get_Atom_Warranty(short_v Warranty_WarrantyDurationType,
                              int_v Warranty_WarrantyDuration,
                              string_v Warranty_WarrantyConditions,
                              ref Atom_DocInvoice_ShopC_Item_Price_Stock_Data pias,
                              ref long Atom_Warranty_ID, ref string Err)
        {
            string scond_WarrantyDurationType = null;
            string sv_WarrantyDurationType = null;
            List<DBConnectionControl40.SQL_Parameter> lpar = new List<DBConnectionControl40.SQL_Parameter>();
            if (Warranty_WarrantyDurationType != null)
            {
                string spar_WarrantyDurationType = "@par_WarrantyDurationType";
                DBConnectionControl40.SQL_Parameter par_WarrantyDurationType = new DBConnectionControl40.SQL_Parameter(spar_WarrantyDurationType, DBConnectionControl40.SQL_Parameter.eSQL_Parameter.Smallint, false, Warranty_WarrantyDurationType.v);
                lpar.Add(par_WarrantyDurationType);
                scond_WarrantyDurationType = "(WarrantyDurationType = " + spar_WarrantyDurationType + ")";
                sv_WarrantyDurationType = spar_WarrantyDurationType;
            }
            else
            {
                scond_WarrantyDurationType = "(WarrantyDurationType is null)";
                sv_WarrantyDurationType = "null";
            }

            string scond_WarrantyDuration = null;
            string sv_WarrantyDuration = null;
            if (Warranty_WarrantyDuration != null)
            {
                string spar_WarrantyDuration = "@par_WarrantyDuration";
                DBConnectionControl40.SQL_Parameter par_WarrantyDuration = new DBConnectionControl40.SQL_Parameter(spar_WarrantyDuration, DBConnectionControl40.SQL_Parameter.eSQL_Parameter.Int, false, Warranty_WarrantyDuration.v);
                lpar.Add(par_WarrantyDuration);
                scond_WarrantyDuration = "(WarrantyDuration = " + spar_WarrantyDuration + ")";
                sv_WarrantyDuration = spar_WarrantyDuration;
            }
            else
            {
                scond_WarrantyDuration = "(WarrantyDuration is null)";
                sv_WarrantyDuration = "null";
            }

            string scond_WarrantyConditions = null;
            string sv_WarrantyConditions = null;
            if (Warranty_WarrantyConditions != null)
            {
                string spar_WarrantyConditions = "@par_WarrantyConditions";
                DBConnectionControl40.SQL_Parameter par_WarrantyConditions = new DBConnectionControl40.SQL_Parameter(spar_WarrantyConditions, DBConnectionControl40.SQL_Parameter.eSQL_Parameter.Varchar, false, Warranty_WarrantyConditions.v);
                lpar.Add(par_WarrantyConditions);
                scond_WarrantyConditions = "(WarrantyConditions = " + spar_WarrantyConditions + ")";
                sv_WarrantyConditions = spar_WarrantyConditions;
            }
            else
            {
                scond_WarrantyConditions = "(WarrantyConditions is null)";
                sv_WarrantyConditions = "null";
            }

            string sql_select_Atom_Warranty_ID = @"select ID as Atom_Warranty_ID from Atom_Warranty where " + scond_WarrantyDurationType + " and " + scond_WarrantyDuration + " and " + scond_WarrantyConditions;

            DataTable dt = new DataTable();
            if (DBSync.DBSync.ReadDataTable(ref dt, sql_select_Atom_Warranty_ID, lpar, ref Err))
            {
                if (dt.Rows.Count > 0)
                {
                    Atom_Warranty_ID = (long)dt.Rows[0]["Atom_Warranty_ID"];
                    return true;
                }
                else
                {
                    string sql_Insert_Atom_Warranty = @"insert into Atom_Warranty (WarrantyDurationType, WarrantyDuration, WarrantyConditions)values(" + sv_WarrantyDurationType + "," + sv_WarrantyDuration + "," + sv_WarrantyConditions + ")";
                    object objret = null;
                    if (DBSync.DBSync.ExecuteNonQuerySQLReturnID(sql_Insert_Atom_Warranty, lpar, ref Atom_Warranty_ID, ref objret, ref Err, DBtcn.stbl_Atom_Warranty_TableName))
                    {
                        return true;
                    }
                    else
                    {
                        LogFile.Error.Show("ERROR:Get_Atom_Warranty:insert into Atom_Warranty failed!\r\nErr=" + Err);
                        return false;
                    }
                }
            }
            else
            {
                LogFile.Error.Show("ERROR:Get_Atom_Warranty:select ID as Atom_Warranty_ID from Atom_Warranty failed!\r\nErr=" + Err);
                return false;
            }
        }
        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);
        }
示例#18
0
        bool Get_Atom_Expiry(int_v Expiry_ExpectedShelfLifeInDays,
                                    int_v Expiry_SaleBeforeExpiryDateInDays,
                                    int_v Expiry_DiscardBeforeExpiryDateInDays,
                                    string_v Expiry_ExpiryDescription,
                                    ref long Atom_Expiry_ID, ref string Err)
        {
            string scond_ExpectedShelfLifeInDays = null;
            string sv_ExpectedShelfLifeInDays = null;
            List<DBConnectionControl40.SQL_Parameter> lpar = new List<DBConnectionControl40.SQL_Parameter>();
            if (Expiry_ExpectedShelfLifeInDays != null)
            {
                string spar_ExpectedShelfLifeInDays = "@par_ExpectedShelfLifeInDays";
                DBConnectionControl40.SQL_Parameter par_ExpectedShelfLifeInDays = new DBConnectionControl40.SQL_Parameter(spar_ExpectedShelfLifeInDays, DBConnectionControl40.SQL_Parameter.eSQL_Parameter.Int, false, Expiry_ExpectedShelfLifeInDays.v);
                lpar.Add(par_ExpectedShelfLifeInDays);
                scond_ExpectedShelfLifeInDays = "(ExpectedShelfLifeInDays = " + spar_ExpectedShelfLifeInDays + ")";
                sv_ExpectedShelfLifeInDays = spar_ExpectedShelfLifeInDays;
            }
            else
            {
                scond_ExpectedShelfLifeInDays = "(ExpectedShelfLifeInDays is null)";
                sv_ExpectedShelfLifeInDays = "null";
            }
            string scond_Expiry_SaleBeforeExpiryDateInDays = null;
            string sv_Expiry_SaleBeforeExpiryDateInDays = null;
            if (Expiry_SaleBeforeExpiryDateInDays != null)
            {
                string spar_SaleBeforeExpiryDateInDays = "@par_SaleBeforeExpiryDateInDays";
                DBConnectionControl40.SQL_Parameter par_SaleBeforeExpiryDateInDays = new DBConnectionControl40.SQL_Parameter(spar_SaleBeforeExpiryDateInDays, DBConnectionControl40.SQL_Parameter.eSQL_Parameter.Int, false, Expiry_SaleBeforeExpiryDateInDays.v);
                lpar.Add(par_SaleBeforeExpiryDateInDays);
                scond_Expiry_SaleBeforeExpiryDateInDays = "(SaleBeforeExpiryDateInDays = " + spar_SaleBeforeExpiryDateInDays + ")";
                sv_Expiry_SaleBeforeExpiryDateInDays = spar_SaleBeforeExpiryDateInDays;
            }
            else
            {
                scond_Expiry_SaleBeforeExpiryDateInDays = "(SaleBeforeExpiryDateInDays is null)";
                sv_Expiry_SaleBeforeExpiryDateInDays = "null";
            }

            string scond_Expiry_DiscardBeforeExpiryDateInDays = null;
            string sv_Expiry_DiscardBeforeExpiryDateInDays = null;
            if (Expiry_DiscardBeforeExpiryDateInDays != null)
            {
                string spar_DiscardBeforeExpiryDateInDays = "@par_DiscardBeforeExpiryDateInDays";
                DBConnectionControl40.SQL_Parameter par_DiscardBeforeExpiryDateInDays = new DBConnectionControl40.SQL_Parameter(spar_DiscardBeforeExpiryDateInDays, DBConnectionControl40.SQL_Parameter.eSQL_Parameter.Int, false, Expiry_DiscardBeforeExpiryDateInDays.v);
                lpar.Add(par_DiscardBeforeExpiryDateInDays);
                scond_Expiry_DiscardBeforeExpiryDateInDays = "(DiscardBeforeExpiryDateInDays = " + spar_DiscardBeforeExpiryDateInDays + ")";
                sv_Expiry_DiscardBeforeExpiryDateInDays = spar_DiscardBeforeExpiryDateInDays;
            }
            else
            {
                scond_Expiry_DiscardBeforeExpiryDateInDays = "(DiscardBeforeExpiryDateInDays is null)";
                sv_Expiry_DiscardBeforeExpiryDateInDays = "null";
            }

            string scond_Expiry_ExpiryDescription = null;
            string sv_Expiry_ExpiryDescription = null;
            if (Expiry_ExpiryDescription != null)
            {
                string spar_ExpiryDescription = "@par_ExpiryDescription";
                DBConnectionControl40.SQL_Parameter par_ExpiryDescription = new DBConnectionControl40.SQL_Parameter(spar_ExpiryDescription, DBConnectionControl40.SQL_Parameter.eSQL_Parameter.Varchar, false, Expiry_ExpiryDescription.v);
                lpar.Add(par_ExpiryDescription);
                scond_Expiry_ExpiryDescription = "(ExpiryDescription = " + spar_ExpiryDescription + ")";
                sv_Expiry_ExpiryDescription = spar_ExpiryDescription;
            }
            else
            {
                scond_Expiry_ExpiryDescription = "(ExpiryDescription is null)";
                sv_Expiry_ExpiryDescription = "null";
            }

            string sql_select_Atom_Expiry_ID = @"select ID as Atom_Expiry_ID from Atom_Expiry where " + scond_ExpectedShelfLifeInDays + " and "
                                                                                                   + scond_Expiry_SaleBeforeExpiryDateInDays + " and "
                                                                                                   + scond_Expiry_DiscardBeforeExpiryDateInDays + " and "
                                                                                                   + scond_Expiry_ExpiryDescription;

            DataTable dt = new DataTable();
            if (DBSync.DBSync.ReadDataTable(ref dt, sql_select_Atom_Expiry_ID, lpar, ref Err))
            {
                if (dt.Rows.Count > 0)
                {
                    Atom_Expiry_ID = (long)dt.Rows[0]["Atom_Expiry_ID"];
                    return true;
                }
                else
                {
                    string sql_Insert_Atom_Item_ExpiryDescription = @"insert into Atom_Expiry (ExpectedShelfLifeInDays,
                                                                                             SaleBeforeExpiryDateInDays,
                                                                                             DiscardBeforeExpiryDateInDays,
                                                                                             ExpiryDescription)values("
                                                                                             + sv_ExpectedShelfLifeInDays + ","
                                                                                             + sv_Expiry_SaleBeforeExpiryDateInDays + ","
                                                                                             + sv_Expiry_DiscardBeforeExpiryDateInDays + ","
                                                                                             + sv_Expiry_ExpiryDescription
                                                                                            + ")";
                    object objret = null;
                    if (DBSync.DBSync.ExecuteNonQuerySQLReturnID(sql_Insert_Atom_Item_ExpiryDescription, lpar, ref Atom_Expiry_ID, ref objret, ref Err, DBtcn.stbl_Atom_Item_ExpiryDescription_TableName))
                    {
                        return true;
                    }
                    else
                    {
                        LogFile.Error.Show("ERROR:Get_Atom_Expiry:insert into Atom_Expiry failed!\r\nErr=" + Err);
                        return false;
                    }
                }
            }
            else
            {
                LogFile.Error.Show("ERROR:Get_Atom_Expiry:select ID as Atom_Expiry_ID from Atom_Expiry failed!\r\nErr=" + Err);
                return false;
            }
        }
示例#19
0
 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;
 }