Esempio n. 1
0
        public ERPConfigDetails Details()
        {
            try
            {
                string SQL = "SELECT " +
                             "LastPONo, " +
                             "PostingDateFrom, " +
                             "PostingDateTo " +
                             "FROM tblERPConfig;";

                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = SQL;

                string strDataTableName = "tbl" + this.GetType().FullName.Split(new Char[] { '.' })[this.GetType().FullName.Split(new Char[] { '.' }).Length - 1]; System.Data.DataTable dt = new System.Data.DataTable(strDataTableName);
                base.MySqlDataAdapterFill(cmd, dt);

                ERPConfigDetails Details = new ERPConfigDetails();

                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    Details.LastPONo        = "" + dr["LastPONo"].ToString();
                    Details.PostingDateFrom = DateTime.Parse(dr["PostingDateFrom"].ToString());
                    Details.PostingDateTo   = DateTime.Parse(dr["PostingDateTo"].ToString());
                }

                return(Details);
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Esempio n. 2
0
        private void AddItemToInventory(long CreditMemoID)
        {
            CreditMemoDetails clsCreditMemoDetails = Details(CreditMemoID);
            ERPConfig         clsERPConfig         = new ERPConfig(base.Connection, base.Transaction);
            ERPConfigDetails  clsERPConfigDetails  = clsERPConfig.Details();

            CreditMemoItems         clsCreditMemoItems         = new CreditMemoItems(base.Connection, base.Transaction);
            ProductUnit             clsProductUnit             = new ProductUnit(base.Connection, base.Transaction);
            Products                clsProduct                 = new Products(base.Connection, base.Transaction);
            ProductVariationsMatrix clsProductVariationsMatrix = new ProductVariationsMatrix(base.Connection, base.Transaction);

            Inventory clsInventory = new Inventory(base.Connection, base.Transaction);

            System.Data.DataTable dt = clsCreditMemoItems.ListAsDataTable(CreditMemoID);

            foreach (System.Data.DataRow dr in dt.Rows)
            {
                long lngProductID     = long.Parse(dr["ProductID"].ToString());
                int  intProductUnitID = int.Parse(dr["ProductUnitID"].ToString());

                decimal decItemQuantity = decimal.Parse(dr["Quantity"].ToString());
                decimal decQuantity     = clsProductUnit.GetBaseUnitValue(lngProductID, intProductUnitID, decItemQuantity);

                long    lngVariationMatrixID = long.Parse(dr["VariationMatrixID"].ToString());
                string  strMatrixDescription = "" + dr["MatrixDescription"].ToString();
                string  strProductCode       = "" + dr["ProductCode"].ToString();
                decimal decUnitCost          = decimal.Parse(dr["UnitCost"].ToString());
                decimal decItemCost          = decimal.Parse(dr["Amount"].ToString());
                decimal decVAT = decimal.Parse(dr["VAT"].ToString());

                /*******************************************
                 * Do not Add to Inventory coz this is a Debit Memo and no effect on inventory
                 * ****************************************/

                /*******************************************
                 * Add to Inventory Analysis
                 * ****************************************/
                InventoryDetails clsInventoryDetails = new InventoryDetails();
                clsInventoryDetails.PostingDateFrom   = clsERPConfigDetails.PostingDateFrom;
                clsInventoryDetails.PostingDateTo     = clsERPConfigDetails.PostingDateTo;
                clsInventoryDetails.PostingDate       = clsCreditMemoDetails.PostingDate;
                clsInventoryDetails.ReferenceNo       = clsCreditMemoDetails.CNNo;
                clsInventoryDetails.ContactID         = clsCreditMemoDetails.CustomerID;
                clsInventoryDetails.ContactCode       = clsCreditMemoDetails.CustomerCode;
                clsInventoryDetails.ProductID         = lngProductID;
                clsInventoryDetails.ProductCode       = strProductCode;
                clsInventoryDetails.VariationMatrixID = lngVariationMatrixID;
                clsInventoryDetails.MatrixDescription = strMatrixDescription;
                clsInventoryDetails.SCreditQuantity   = decQuantity;
                clsInventoryDetails.SCreditCost       = decItemCost - decVAT;
                clsInventoryDetails.SCreditVAT        = decItemCost; //Sales Return with VAT

                clsInventory.Insert(clsInventoryDetails);
            }
            //myReader.Close();
        }
Esempio n. 3
0
		private void SaveRecord()
		{
			
			ERPConfigDetails clsDetails = new ERPConfigDetails();

			clsDetails.PostingDateFrom = Convert.ToDateTime(txtDateFrom.Text);
			clsDetails.PostingDateTo = Convert.ToDateTime(txtDateTo.Text);

			ERPConfig clsERPConfig = new ERPConfig();
			clsERPConfig.UpdatePostingDate(clsDetails.PostingDateFrom, clsDetails.PostingDateTo);

			clsERPConfig.CommitAndDispose();
		}
Esempio n. 4
0
		public ERPConfigDetails Details()
		{
			try
			{
				string SQL=	"SELECT " +
								"LastPONo, " +
								"PostingDateFrom, " +
								"PostingDateTo " +
							"FROM tblERPConfig;";
				  
				MySqlCommand cmd = new MySqlCommand();
				cmd.CommandType = System.Data.CommandType.Text;
				cmd.CommandText = SQL;

                string strDataTableName = "tbl" + this.GetType().FullName.Split(new Char[] { '.' })[this.GetType().FullName.Split(new Char[] { '.' }).Length - 1]; System.Data.DataTable dt = new System.Data.DataTable(strDataTableName);
                base.MySqlDataAdapterFill(cmd, dt);
				
				ERPConfigDetails Details = new ERPConfigDetails();

				foreach(System.Data.DataRow dr in dt.Rows)
				{
					Details.LastPONo = "" + dr["LastPONo"].ToString();
					Details.PostingDateFrom = DateTime.Parse(dr["PostingDateFrom"].ToString());
					Details.PostingDateTo = DateTime.Parse(dr["PostingDateTo"].ToString());
				}

				return Details;
			}

			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
Esempio n. 5
0
        public Int32 Save(ERPConfigDetails Details)
        {
            try
            {
                string SQL = "CALL procSaveERPConfig(@ERPConfigID, @LastPONo, @LastPOReturnNo, @LastDebitMemoNo, @LastSONo, " +
                                "@LastSOReturnNo, @LastCreditMemoNo, @LastTransferInNo, @LastTransferOutNo, " +
                                "@LastInvAdjustmentNo, @LastClosingNo, @PostingDateFrom, @PostingDateTo, " +
                                "@ChartOfAccountIDAPTracking, @ChartOfAccountIDAPBills, @ChartOfAccountIDAPFreight, " +
                                "@ChartOfAccountIDAPVDeposit, @ChartOfAccountIDAPContra, @ChartOfAccountIDAPLatePayment, " +
                                "@ChartOfAccountIDARTracking, @ChartOfAccountIDARBills, @ChartOfAccountIDARFreight, " +
                                "@ChartOfAccountIDARVDeposit, @ChartOfAccountIDARContra, @ChartOfAccountIDARLatePayment, " +
                                "@LastCreditCardNo, @LastRewardCardNo, @DBVersion, @DBVersionSales, @LastBranchTransferNo,  @LastWBranchTransferNo" +
								"@LastCustomerCode, @CreatedOn, @LastModified);";

                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = SQL;

                cmd.Parameters.AddWithValue("ERPConfigID", Details.ERPConfigID);
                cmd.Parameters.AddWithValue("LastPONo", Details.LastPONo);
                cmd.Parameters.AddWithValue("LastPOReturnNo", Details.LastPOReturnNo);
                cmd.Parameters.AddWithValue("LastDebitMemoNo", Details.LastDebitMemoNo);
                cmd.Parameters.AddWithValue("LastSONo", Details.LastSONo);
                cmd.Parameters.AddWithValue("LastSOReturnNo", Details.LastSOReturnNo);
                cmd.Parameters.AddWithValue("LastCreditMemoNo", Details.LastCreditMemoNo);
                cmd.Parameters.AddWithValue("LastTransferInNo", Details.LastTransferInNo);
                cmd.Parameters.AddWithValue("LastTransferOutNo", Details.LastTransferOutNo);
                cmd.Parameters.AddWithValue("LastInvAdjustmentNo", Details.LastInvAdjustmentNo);
                cmd.Parameters.AddWithValue("LastClosingNo", Details.LastClosingNo);
                cmd.Parameters.AddWithValue("PostingDateFrom", Details.PostingDateFrom);
                cmd.Parameters.AddWithValue("PostingDateTo", Details.PostingDateTo);
                cmd.Parameters.AddWithValue("ChartOfAccountIDAPTracking", Details.APLinkConfigDetails.ChartOfAccountIDAPTracking);
                cmd.Parameters.AddWithValue("ChartOfAccountIDAPBills", Details.APLinkConfigDetails.ChartOfAccountIDAPBills);
                cmd.Parameters.AddWithValue("ChartOfAccountIDAPFreight", Details.APLinkConfigDetails.ChartOfAccountIDAPFreight);
                cmd.Parameters.AddWithValue("ChartOfAccountIDAPVDeposit", Details.APLinkConfigDetails.ChartOfAccountIDAPVDeposit);
                cmd.Parameters.AddWithValue("ChartOfAccountIDAPContra", Details.APLinkConfigDetails.ChartOfAccountIDAPContra);
                cmd.Parameters.AddWithValue("ChartOfAccountIDAPLatePayment", Details.APLinkConfigDetails.ChartOfAccountIDAPLatePayment);
                cmd.Parameters.AddWithValue("ChartOfAccountIDARTracking", Details.ARLinkConfigDetails.ChartOfAccountIDARTracking);
                cmd.Parameters.AddWithValue("ChartOfAccountIDARBills", Details.ARLinkConfigDetails.ChartOfAccountIDARBills);
                cmd.Parameters.AddWithValue("ChartOfAccountIDARFreight", Details.ARLinkConfigDetails.ChartOfAccountIDARFreight);
                cmd.Parameters.AddWithValue("ChartOfAccountIDARVDeposit", Details.ARLinkConfigDetails.ChartOfAccountIDARVDeposit);
                cmd.Parameters.AddWithValue("ChartOfAccountIDARContra", Details.ARLinkConfigDetails.ChartOfAccountIDARContra);
                cmd.Parameters.AddWithValue("ChartOfAccountIDARLatePayment", Details.ARLinkConfigDetails.ChartOfAccountIDARLatePayment);
                cmd.Parameters.AddWithValue("LastCreditCardNo", Details.LastCreditCardNo);
                cmd.Parameters.AddWithValue("LastRewardCardNo", Details.LastRewardCardNo);
                cmd.Parameters.AddWithValue("DBVersion", Details.DBVersion);
                cmd.Parameters.AddWithValue("DBVersionSales", Details.DBVersionSales);
                cmd.Parameters.AddWithValue("LastBranchTransferNo", Details.LastBranchTransferNo);
                cmd.Parameters.AddWithValue("LastWBranchTransferNo", Details.LastWBranchTransferNo);
                cmd.Parameters.AddWithValue("LastCustomerCode", Details.LastCustomerCode);
                cmd.Parameters.AddWithValue("CreatedOn", Details.CreatedOn == DateTime.MinValue ? Constants.C_DATE_MIN_VALUE : Details.CreatedOn);
                cmd.Parameters.AddWithValue("LastModified", Details.LastModified == DateTime.MinValue ? Constants.C_DATE_MIN_VALUE : Details.LastModified);

                return base.ExecuteNonQuery(cmd);
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Esempio n. 6
0
        private void AddItemToInventory(long WBranchTransferID)
        {
            WBranchTransferDetails clsWBranchTransferDetails = Details(WBranchTransferID);
            ERPConfig        clsERPConfig        = new ERPConfig(base.Connection, base.Transaction);
            ERPConfigDetails clsERPConfigDetails = clsERPConfig.Details();

            WBranchTransferItem clsWBranchTransferItem = new WBranchTransferItem(base.Connection, base.Transaction);
            ProductUnit         clsProductUnit         = new ProductUnit(base.Connection, base.Transaction);
            Products            clsProduct             = new Products(base.Connection, base.Transaction);

            Inventory        clsInventory = new Inventory(base.Connection, base.Transaction);
            InventoryDetails clsInventoryDetails;

            System.Data.DataTable dt = clsWBranchTransferItem.ListAsDataTable(WBranchTransferID, "WBranchTransferItemID", SortOption.Ascending);

            foreach (System.Data.DataRow dr in dt.Rows)
            {
                long lngProductID     = Int64.Parse(dr["ProductID"].ToString());
                int  intProductUnitID = Int16.Parse(dr["ProductUnitID"].ToString());

                decimal decItemQuantity = decimal.Parse(dr["Quantity"].ToString());
                decimal decQuantity     = clsProductUnit.GetBaseUnitValue(lngProductID, intProductUnitID, decItemQuantity);

                long    lngVariationMatrixID = Int64.Parse(dr["VariationMatrixID"].ToString());
                string  strMatrixDescription = "" + dr["MatrixDescription"].ToString();
                string  strProductCode       = "" + dr["ProductCode"].ToString();
                string  strProductUnitCode   = "" + dr["ProductUnitCode"].ToString();
                decimal decUnitCost          = decimal.Parse(dr["UnitCost"].ToString());
                decimal decItemCost          = decimal.Parse(dr["Amount"].ToString());
                decimal decVAT = decimal.Parse(dr["VAT"].ToString());

                /*******************************************
                 * Subtract BranchIDFrom then Add to BranchIDTo -- Inventory
                 * ****************************************/
                clsProduct.SubtractQuantity(clsWBranchTransferDetails.BranchIDFrom, lngProductID, lngVariationMatrixID, decQuantity, Products.getPRODUCT_INVENTORY_MOVEMENT_VALUE(PRODUCT_INVENTORY_MOVEMENT.DEDUCT_BRANCH_TRANSFER_FROM) + " " + clsWBranchTransferDetails.BranchCodeFrom + " @ " + decUnitCost.ToString("#,##0.#0") + "/" + strProductUnitCode, DateTime.Now, clsWBranchTransferDetails.WBranchTransferNo, clsWBranchTransferDetails.TransferrerName);
                clsProduct.AddQuantity(clsWBranchTransferDetails.BranchIDTo, lngProductID, lngVariationMatrixID, decQuantity, Products.getPRODUCT_INVENTORY_MOVEMENT_VALUE(PRODUCT_INVENTORY_MOVEMENT.ADD_BRANCH_TRANSFER_TO) + " " + clsWBranchTransferDetails.BranchCodeTo + " @ " + decUnitCost.ToString("#,##0.#0") + "/" + strProductUnitCode, DateTime.Now, clsWBranchTransferDetails.WBranchTransferNo, clsWBranchTransferDetails.TransferrerName);

                /*******************************************
                 * Add to Inventory Analysis
                 * ****************************************/
                clsInventoryDetails = new InventoryDetails();
                clsInventoryDetails.PostingDateFrom   = clsERPConfigDetails.PostingDateFrom;
                clsInventoryDetails.PostingDateTo     = clsERPConfigDetails.PostingDateTo;
                clsInventoryDetails.PostingDate       = clsWBranchTransferDetails.DeliveryDate;
                clsInventoryDetails.ReferenceNo       = clsWBranchTransferDetails.WBranchTransferNo;
                clsInventoryDetails.ContactID         = Constants.C_RETAILPLUS_SUPPLIERID;
                clsInventoryDetails.ContactCode       = Constants.C_RETAILPLUS_SUPPLIER;
                clsInventoryDetails.ProductID         = lngProductID;
                clsInventoryDetails.ProductCode       = strProductCode;
                clsInventoryDetails.VariationMatrixID = lngVariationMatrixID;
                clsInventoryDetails.MatrixDescription = strMatrixDescription;

                clsInventoryDetails.PurchaseCost = decItemCost - decVAT;
                clsInventoryDetails.PurchaseVAT  = decItemCost; // Purchase Cost with VAT

                // insert into branchid from with minus quantity
                clsInventoryDetails.BranchID         = clsWBranchTransferDetails.BranchIDFrom;
                clsInventoryDetails.PurchaseQuantity = -decQuantity;
                clsInventory.Insert(clsInventoryDetails);

                // insert into branchid to with add quantity
                clsInventoryDetails.BranchID         = clsWBranchTransferDetails.BranchIDTo;
                clsInventoryDetails.PurchaseQuantity = decQuantity;
                clsInventory.Insert(clsInventoryDetails);
            }
        }
Esempio n. 7
0
        public Int32 Save(ERPConfigDetails Details)
        {
            try
            {
                string SQL = "CALL procSaveERPConfig(@ERPConfigID, @LastPONo, @LastPOReturnNo, @LastDebitMemoNo, @LastSONo, " +
                             "@LastSOReturnNo, @LastCreditMemoNo, @LastTransferInNo, @LastTransferOutNo, " +
                             "@LastInvAdjustmentNo, @LastClosingNo, @PostingDateFrom, @PostingDateTo, " +
                             "@ChartOfAccountIDAPTracking, @ChartOfAccountIDAPBills, @ChartOfAccountIDAPFreight, " +
                             "@ChartOfAccountIDAPVDeposit, @ChartOfAccountIDAPContra, @ChartOfAccountIDAPLatePayment, " +
                             "@ChartOfAccountIDARTracking, @ChartOfAccountIDARBills, @ChartOfAccountIDARFreight, " +
                             "@ChartOfAccountIDARVDeposit, @ChartOfAccountIDARContra, @ChartOfAccountIDARLatePayment, " +
                             "@LastCreditCardNo, @LastRewardCardNo, @DBVersion, @DBVersionSales, @LastBranchTransferNo,  @LastWBranchTransferNo" +
                             "@LastCustomerCode, @CreatedOn, @LastModified);";

                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = SQL;

                cmd.Parameters.AddWithValue("ERPConfigID", Details.ERPConfigID);
                cmd.Parameters.AddWithValue("LastPONo", Details.LastPONo);
                cmd.Parameters.AddWithValue("LastPOReturnNo", Details.LastPOReturnNo);
                cmd.Parameters.AddWithValue("LastDebitMemoNo", Details.LastDebitMemoNo);
                cmd.Parameters.AddWithValue("LastSONo", Details.LastSONo);
                cmd.Parameters.AddWithValue("LastSOReturnNo", Details.LastSOReturnNo);
                cmd.Parameters.AddWithValue("LastCreditMemoNo", Details.LastCreditMemoNo);
                cmd.Parameters.AddWithValue("LastTransferInNo", Details.LastTransferInNo);
                cmd.Parameters.AddWithValue("LastTransferOutNo", Details.LastTransferOutNo);
                cmd.Parameters.AddWithValue("LastInvAdjustmentNo", Details.LastInvAdjustmentNo);
                cmd.Parameters.AddWithValue("LastClosingNo", Details.LastClosingNo);
                cmd.Parameters.AddWithValue("PostingDateFrom", Details.PostingDateFrom);
                cmd.Parameters.AddWithValue("PostingDateTo", Details.PostingDateTo);
                cmd.Parameters.AddWithValue("ChartOfAccountIDAPTracking", Details.APLinkConfigDetails.ChartOfAccountIDAPTracking);
                cmd.Parameters.AddWithValue("ChartOfAccountIDAPBills", Details.APLinkConfigDetails.ChartOfAccountIDAPBills);
                cmd.Parameters.AddWithValue("ChartOfAccountIDAPFreight", Details.APLinkConfigDetails.ChartOfAccountIDAPFreight);
                cmd.Parameters.AddWithValue("ChartOfAccountIDAPVDeposit", Details.APLinkConfigDetails.ChartOfAccountIDAPVDeposit);
                cmd.Parameters.AddWithValue("ChartOfAccountIDAPContra", Details.APLinkConfigDetails.ChartOfAccountIDAPContra);
                cmd.Parameters.AddWithValue("ChartOfAccountIDAPLatePayment", Details.APLinkConfigDetails.ChartOfAccountIDAPLatePayment);
                cmd.Parameters.AddWithValue("ChartOfAccountIDARTracking", Details.ARLinkConfigDetails.ChartOfAccountIDARTracking);
                cmd.Parameters.AddWithValue("ChartOfAccountIDARBills", Details.ARLinkConfigDetails.ChartOfAccountIDARBills);
                cmd.Parameters.AddWithValue("ChartOfAccountIDARFreight", Details.ARLinkConfigDetails.ChartOfAccountIDARFreight);
                cmd.Parameters.AddWithValue("ChartOfAccountIDARVDeposit", Details.ARLinkConfigDetails.ChartOfAccountIDARVDeposit);
                cmd.Parameters.AddWithValue("ChartOfAccountIDARContra", Details.ARLinkConfigDetails.ChartOfAccountIDARContra);
                cmd.Parameters.AddWithValue("ChartOfAccountIDARLatePayment", Details.ARLinkConfigDetails.ChartOfAccountIDARLatePayment);
                cmd.Parameters.AddWithValue("LastCreditCardNo", Details.LastCreditCardNo);
                cmd.Parameters.AddWithValue("LastRewardCardNo", Details.LastRewardCardNo);
                cmd.Parameters.AddWithValue("DBVersion", Details.DBVersion);
                cmd.Parameters.AddWithValue("DBVersionSales", Details.DBVersionSales);
                cmd.Parameters.AddWithValue("LastBranchTransferNo", Details.LastBranchTransferNo);
                cmd.Parameters.AddWithValue("LastWBranchTransferNo", Details.LastWBranchTransferNo);
                cmd.Parameters.AddWithValue("LastCustomerCode", Details.LastCustomerCode);
                cmd.Parameters.AddWithValue("CreatedOn", Details.CreatedOn == DateTime.MinValue ? Constants.C_DATE_MIN_VALUE : Details.CreatedOn);
                cmd.Parameters.AddWithValue("LastModified", Details.LastModified == DateTime.MinValue ? Constants.C_DATE_MIN_VALUE : Details.LastModified);

                return(base.ExecuteNonQuery(cmd));
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }