Esempio n. 1
0
		private void SetDataSource(ReportDocument Report)
		{
            Int64 iID = 0;
            try
            {
                if (Request.QueryString["task"].ToString().ToLower() == "reportfromposted" && Request.QueryString["branchtransferid"].ToString() != null)
                { iID = Convert.ToInt64(Request.QueryString["branchtransferid"].ToString()); }
                else
                { iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["branchtransferid"].ToString(), Session.SessionID)); }
            }
            catch { iID = Convert.ToInt64(Common.Decrypt(lblReferrer.Text.Substring(lblReferrer.Text.IndexOf("branchtransferid") + 13), Session.SessionID)); }

			ReportDataset rptds = new ReportDataset();

            BranchTransfer clsBranchTransfer = new BranchTransfer();
			System.Data.DataTable dt = clsBranchTransfer.ListAsDataTable(iID);
            BranchTransferItem clsBranchTransferItem = new BranchTransferItem(clsBranchTransfer.Connection, clsBranchTransfer.Transaction);
            System.Data.DataTable dtitems = clsBranchTransferItem.ListAsDataTable(iID);
            clsBranchTransfer.CommitAndDispose();

            foreach (System.Data.DataRow dr in dt.Rows)
			{
				DataRow drNew = rptds.BranchTransfer.NewRow();

                foreach (DataColumn dc in rptds.BranchTransfer.Columns)
					drNew[dc] = dr[dc.ColumnName];

                rptds.BranchTransfer.Rows.Add(drNew);
			}

            foreach (System.Data.DataRow dr in dtitems.Rows)
			{
				DataRow drNew = rptds.BranchTransferItems.NewRow();

                foreach (DataColumn dc in rptds.BranchTransferItems.Columns)
					drNew[dc] = dr[dc.ColumnName];

                rptds.BranchTransferItems.Rows.Add(drNew);
			}
            
			Report.SetDataSource(rptds); 
			SetParameters(Report);
		}
Esempio n. 2
0
		private void AddItemToInventory(long BranchTransferID)
		{

			BranchTransferDetails clsBranchTransferDetails = Details(BranchTransferID);
            ERPConfig clsERPConfig = new ERPConfig(base.Connection, base.Transaction);
			ERPConfigDetails clsERPConfigDetails = clsERPConfig.Details();

			BranchTransferItem clsBranchTransferItem = new BranchTransferItem(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 = clsBranchTransferItem.ListAsDataTable(BranchTransferID, "BranchTransferItemID", 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(clsBranchTransferDetails.BranchIDFrom, lngProductID, lngVariationMatrixID, decQuantity, Products.getPRODUCT_INVENTORY_MOVEMENT_VALUE(PRODUCT_INVENTORY_MOVEMENT.DEDUCT_BRANCH_TRANSFER_FROM) + " " + clsBranchTransferDetails.BranchCodeFrom + " @ " + decUnitCost.ToString("#,##0.#0") + "/" + strProductUnitCode, DateTime.Now, clsBranchTransferDetails.BranchTransferNo, clsBranchTransferDetails.TransferrerName);
                clsProduct.AddQuantity(clsBranchTransferDetails.BranchIDTo, lngProductID, lngVariationMatrixID, decQuantity, Products.getPRODUCT_INVENTORY_MOVEMENT_VALUE(PRODUCT_INVENTORY_MOVEMENT.ADD_BRANCH_TRANSFER_TO) + " " + clsBranchTransferDetails.BranchCodeTo + " @ " + decUnitCost.ToString("#,##0.#0") + "/" + strProductUnitCode, DateTime.Now, clsBranchTransferDetails.BranchTransferNo, clsBranchTransferDetails.TransferrerName);

				/*******************************************
				 * Add to Inventory Analysis
				 * ****************************************/
				clsInventoryDetails = new InventoryDetails();
				clsInventoryDetails.PostingDateFrom = clsERPConfigDetails.PostingDateFrom;
				clsInventoryDetails.PostingDateTo = clsERPConfigDetails.PostingDateTo;
				clsInventoryDetails.PostingDate = clsBranchTransferDetails.DeliveryDate;
				clsInventoryDetails.ReferenceNo = clsBranchTransferDetails.BranchTransferNo;
				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 = clsBranchTransferDetails.BranchIDFrom;
                clsInventoryDetails.PurchaseQuantity = -decQuantity;
                clsInventory.Insert(clsInventoryDetails);

                // insert into branchid to with add quantity
                clsInventoryDetails.BranchID = clsBranchTransferDetails.BranchIDTo;
                clsInventoryDetails.PurchaseQuantity = decQuantity;
                clsInventory.Insert(clsInventoryDetails);

			}

		}
Esempio n. 3
0
		private void LoadItems()
		{
			BranchTransferItem clsBranchTransferItem = new BranchTransferItem();
			lstItem.DataSource = clsBranchTransferItem.ListAsDataTable(Convert.ToInt64(lblBranchTransferID.Text), "BranchTransferItemID",SortOption.Ascending).DefaultView;
			lstItem.DataBind();
			clsBranchTransferItem.CommitAndDispose();
		}
Esempio n. 4
0
		private void LoadItems()
		{
			DataClass clsDataClass = new DataClass();

			BranchTransferItem clsBranchTransferItem = new BranchTransferItem();
            lstItem.DataSource = clsBranchTransferItem.ListAsDataTable(Convert.ToInt64(lblBranchTransferID.Text)).DefaultView;
			lstItem.DataBind();
			clsBranchTransferItem.CommitAndDispose();
		}