Exemplo n.º 1
0
 public Form_StockItem_Edit(CodeTables.DBTableControl xdbTables, SQLTable xtbl,string where_condition, string ColumnToOrderBy,TangentaDB.Item_Data x_Item_Data, NavigationButtons.Navigation xnav)
 {
     InitializeComponent();
     nav = xnav;
     m_Item_Data = x_Item_Data;
     lngRPM.s_lbl_Item_Stock.Text(lbl_Item_Stock);
     this.lbl_Item.Text = m_Item_Data.Item_UniqueName.v;
     dbTables = xdbTables;
     tbl = xtbl;
     this.Text = lngRPM.s_Stock.s;
     string selection = @"Stock_$_ppi_$_i_$$UniqueName,Stock_$$dQuantity,Stock_$$ExpiryDate, Stock_$_ppi_$_pp_$$PurchasePricePerUnit,Stock_$$ImportTime,Stock_$_ppi_$_i_$$Description,Stock_$_ppi_$_st_$_sup_$_c_$_orgd_$_org_$$Name,Stock_$_ppi_$_i_$$Code,Stock_$_ppi_$_i_$_u_$$Name,Stock_$_ppi_$_i_$_u_$$Symbol,Stock_$_ppi_$_i_$_u_$$DecimalPlaces,Stock_$_ppi_$_i_$_u_$$StorageOption,Stock_$_ppi_$_i_$_exp_$$ExpectedShelfLifeInDays,Stock_$_ppi_$_i_$_exp_$$SaleBeforeExpiryDateInDays,Stock_$_ppi_$_i_$_exp_$$DiscardBeforeExpiryDateInDays,Stock_$_ppi_$_i_$_wrty_$$WarrantyDuration, Stock_$_ppi_$_i_$_wrty_$$WarrantyDurationType,Stock_$_ppi_$_i_$_wrty_$$WarrantyConditions,Stock_$_ppi_$_i_$_iimg_$$Image_Data,ID";
     if (m_usrc_EditTable.Init(dbTables, tbl, selection,ColumnToOrderBy,false,where_condition,null,false,nav))
     {
         if (m_usrc_EditTable.RowsCount==0)
         {
             if (f_PurchasePrice_Item.GetOneFrom_Item_ID(m_Item_Data.Item_ID.v, ref PurchasePrice_Item_ID))
             {
                 m_usrc_EditTable.FillInitialData();
             }
             else
             {
                 bclose = true;
                 return;
             }
         }
         m_usrc_EditTable.CallBackSetInputControlProperties(m_Item_Data.Unit_DecimalPlaces.v);
     }
     else
     {
         bclose = true;
     }
 }
Exemplo n.º 2
0
 public Atom_DocInvoice_ShopC_Item_Price_Stock_Data Contains(Item_Data m_Item_Data)
 {
     foreach (object o in this.m_DocInvoice_ShopC_Item_Data_LIST)
     {
         if (((Atom_DocInvoice_ShopC_Item_Price_Stock_Data)o).Atom_Item_UniqueName.v.Equals(m_Item_Data.Item_UniqueName.v))
         {
             return ((Atom_DocInvoice_ShopC_Item_Price_Stock_Data)o);
         }
     }
     return null;
 }
Exemplo n.º 3
0
 public void Add(long xDocInvoice_ID,object xusrc_Item,Item_Data xItemData,decimal xFactoryQuantity, decimal xStockQuantity,  ref Atom_DocInvoice_ShopC_Item_Price_Stock_Data appisd, bool b_from_factory)
 {
     foreach (Atom_DocInvoice_ShopC_Item_Price_Stock_Data appisdx in m_DocInvoice_ShopC_Item_Data_LIST)
     {
         if (appisdx.Item_ID.v == xItemData.Item_ID.v)
         {
             appisdx.m_ShopShelf_Source.Add_Stock_Data(xItemData, xFactoryQuantity, xStockQuantity, b_from_factory);
             appisd = appisdx;
             return;
         }
     }
     appisd = new Atom_DocInvoice_ShopC_Item_Price_Stock_Data();
     appisd.Set(xusrc_Item, xItemData, xDocInvoice_ID, xFactoryQuantity, xStockQuantity, b_from_factory);
     m_DocInvoice_ShopC_Item_Data_LIST.Add(appisd);
 }
Exemplo n.º 4
0
        private void Set()
        {
            items.Clear();
            foreach (DataRow dr in dt_Price_Item_Stock.Rows)
            {
                Item_Data xItem_Data = new Item_Data();
                xItem_Data.Set_Price_Item_Stock(dr);
                if (dr[m_cpis.icol_Item_ID] is long)
                {
                    long item_id = (long)dr[m_cpis.icol_Item_ID];
                    if (ExistingItem(item_id, xItem_Data))
                    {
                        continue;
                    }
                    else
                    {
                        Stock_Data stock_data = new Stock_Data();
                        if (xItem_Data.Stock_ID != null)
                        {
                            stock_data.Stock_ID = new DBTypes.long_v();
                            stock_data.Stock_ID.v = xItem_Data.Stock_ID.v;
                        }
                        else
                        {
                            stock_data.Stock_ID = null;
                        }

                        if (xItem_Data.Stock_ImportTime != null)
                        {
                            stock_data.Stock_ImportTime = new DBTypes.DateTime_v();
                            stock_data.Stock_ImportTime.v = xItem_Data.Stock_ImportTime.v;
                        }
                        else
                        {
                            stock_data.Stock_ImportTime = null;
                        }

                        if (xItem_Data.Stock_ExpiryDate != null)
                        {
                            stock_data.Stock_ExpiryDate = new DBTypes.DateTime_v();
                            stock_data.Stock_ExpiryDate.v = xItem_Data.Stock_ExpiryDate.v;
                        }
                        else
                        {
                            stock_data.Stock_ExpiryDate = null;
                        }

                        if (xItem_Data.Stock_dQuantity != null)
                        {
                            stock_data.dQuantity = new DBTypes.decimal_v();
                            stock_data.dQuantity.v = xItem_Data.Stock_dQuantity.v;
                        }
                        else
                        {
                            stock_data.dQuantity = null;
                        }
                        xItem_Data.Stock_Data_List.Add(stock_data);
                        items.Add(xItem_Data);
                    }
                }
                else
                {
                    LogFile.Error.Show("ERROR:ShopShelf:Set:dr[m_cpis.icol_Item_ID] is not long !");
                }
            }
        }
Exemplo n.º 5
0
        private bool ExistingItem(long item_id, Item_Data xItem_Data)
        {
            foreach (object o in items)
            {
                Item_Data idata = (Item_Data)o;
                if (idata.Item_ID != null)
                {
                    if (idata.Item_ID.v == item_id)
                    {
                        Stock_Data stock_data = new Stock_Data();
                        if (xItem_Data.Stock_ID != null)
                        {
                            stock_data.Stock_ID = new DBTypes.long_v();
                            stock_data.Stock_ID.v = xItem_Data.Stock_ID.v;
                        }
                        else
                        {
                            stock_data.Stock_ID = null;
                        }

                        if (xItem_Data.Stock_ImportTime != null)
                        {
                            stock_data.Stock_ImportTime = new DBTypes.DateTime_v();
                            stock_data.Stock_ImportTime.v = xItem_Data.Stock_ImportTime.v;
                        }
                        else
                        {
                            stock_data.Stock_ImportTime = null;
                        }

                        if (xItem_Data.Stock_ExpiryDate != null)
                        {
                            stock_data.Stock_ExpiryDate = new DBTypes.DateTime_v();
                            stock_data.Stock_ExpiryDate.v = xItem_Data.Stock_ExpiryDate.v;
                        }
                        else
                        {
                            stock_data.Stock_ExpiryDate = null;
                        }

                        if (xItem_Data.Stock_dQuantity != null)
                        {
                            stock_data.dQuantity = new DBTypes.decimal_v();
                            stock_data.dQuantity.v = xItem_Data.Stock_dQuantity.v;
                        }
                        else
                        {
                            stock_data.dQuantity = null;
                        }
                        idata.Stock_Data_List.Add(stock_data);
                        return true;
                    }
                }
            }
            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);
        }
Exemplo n.º 7
0
 public void Add_Stock_Data(Item_Data xItem_Data, decimal xFactoryQuantity,decimal xStockQuantity,  bool b_from_factory)
 {
     if (b_from_factory)
     {
         Stock_Data stock_data = new Stock_Data();
         if (stock_data.dQuantity == null)
         {
             stock_data.dQuantity = new decimal_v();
         }
         stock_data.dQuantity.v = xFactoryQuantity;
         Stock_Data_List.Add(stock_data);
     }
     else
     {
         decimal dquantity = xStockQuantity;
         xItem_Data.Stock_Data_List.Sort((x, y) => Compare_Stock_ExpiryDate(x,y));
         foreach (Stock_Data sd in xItem_Data.Stock_Data_List)
         {
             if (dquantity > 0)
             {
                 if (sd.dQuantity_from_stock != null)
                 {
                     Stock_Data stock_data = new Stock_Data();
                     if (dquantity > sd.dQuantity_from_stock.v)
                     {
                         dquantity -= sd.dQuantity_from_stock.v;
                         if (stock_data.dQuantity == null)
                         {
                             stock_data.dQuantity = new decimal_v();
                         }
                         stock_data.dQuantity.v = sd.dQuantity_from_stock.v;
                         sd.dQuantity.v = 0;
                         if (stock_data.dQuantity_New_in_Stock == null)
                         {
                             stock_data.dQuantity_New_in_Stock = new decimal_v();
                         }
                         stock_data.dQuantity_New_in_Stock.v = 0;
                         stock_data.Stock_ID = new long_v();
                         stock_data.Stock_ID.v = sd.Stock_ID.v;
                         Stock_Data_List.Add(stock_data);
                     }
                     else
                     {
                         if (stock_data.dQuantity_from_stock == null)
                         {
                             stock_data.dQuantity = new decimal_v();
                         }
                         stock_data.dQuantity.v = dquantity;
                         sd.dQuantity.v -= dquantity;
                         if (stock_data.dQuantity_New_in_Stock == null)
                         {
                             stock_data.dQuantity_New_in_Stock = new decimal_v();
                         }
                         stock_data.dQuantity_New_in_Stock.v = sd.dQuantity.v;
                         stock_data.Stock_ID = new long_v();
                         stock_data.Stock_ID.v = sd.Stock_ID.v;
                         dquantity = 0;
                         Stock_Data_List.Add(stock_data);
                     }
                 }
             }
             else
             {
                 break;
             }
         }
     }
 }