public void Update(TransferOutItemDetails Details)
        {
            try
            {
                string SQL = "UPDATE tblTransferOutItems SET " +
                                "TransferOutID					=	@TransferOutID, " +
                                "ProductID				=	@ProductID, " +
                                "ProductCode			=	@ProductCode, " +
                                "BarCode				=	@BarCode, " +
                                "Description			=	@Description, " +
                                "ProductUnitID			=	@ProductUnitID, " +
                                "ProductUnitCode		=	@ProductUnitCode, " +
                                "Quantity				=	@Quantity, " +
                                "OriginalQuantity       =   @Quantity, " +
                                "UnitCost				=	@UnitCost, " +
                                "Discount				=	@Discount, " +
                                "DiscountApplied		=	@DiscountApplied, " +
                                "DiscountType			=	@DiscountType, " +
                                "Amount					=	@Amount, " +
                                "VAT					=	@VAT, " +
                                "VatableAmount			=	@VatableAmount, " +
                                "EVAT					=	@EVAT, " +
                                "EVatableAmount			=	@EVatableAmount, " +
                                "LocalTax				=	@LocalTax, " +
                                "isVATInclusive			=	@isVATInclusive, " +
                                "VariationMatrixID		=	@VariationMatrixID, " +
                                "MatrixDescription		=	@MatrixDescription, " +
                                "ProductGroup			=	@ProductGroup, " +
                                "ProductSubGroup		=	@ProductSubGroup, " +
                                "TransferOutItemStatus	=	@TransferOutItemStatus, " +
                                "IsVatable				=	@IsVatable, " +
                                "Remarks				=	@Remarks, " +
                                "ChartOfAccountIDTransferOut       = (SELECT ChartOfAccountIDTransferOut FROM tblProducts WHERE ProductID = @ProductID), " +
                                "ChartOfAccountIDTaxTransferOut    = (SELECT ChartOfAccountIDTaxTransferOut FROM tblProducts WHERE ProductID = @ProductID), " +
                                "ChartOfAccountIDInventory      = (SELECT ChartOfAccountIDInventory FROM tblProducts WHERE ProductID = @ProductID), " +
                                "SellingPrice			=	@SellingPrice, " +
                                "SellingVAT				=	@SellingVAT, " +
                                "SellingEVAT			=	@SellingEVAT, " +
                                "SellingLocalTax		=	@SellingLocalTax, " +
                                "OldSellingPrice		=	@OldSellingPrice " +
                            "WHERE TransferOutItemID = @TransferOutItemID;";

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

                MySqlParameter prmTransferOutID = new MySqlParameter("@TransferOutID",MySqlDbType.Int64);
                prmTransferOutID.Value = Details.TransferOutID;
                cmd.Parameters.Add(prmTransferOutID);

                MySqlParameter prmProductID = new MySqlParameter("@ProductID",MySqlDbType.Int64);
                prmProductID.Value = Details.ProductID;
                cmd.Parameters.Add(prmProductID);

                MySqlParameter prmProductCode = new MySqlParameter("@ProductCode",MySqlDbType.String);
                prmProductCode.Value = Details.ProductCode;
                cmd.Parameters.Add(prmProductCode);

                MySqlParameter prmBarCode = new MySqlParameter("@BarCode",MySqlDbType.String);
                prmBarCode.Value = Details.BarCode;
                cmd.Parameters.Add(prmBarCode);

                MySqlParameter prmDescription = new MySqlParameter("@Description",MySqlDbType.String);
                prmDescription.Value = Details.Description;
                cmd.Parameters.Add(prmDescription);

                MySqlParameter prmProductUnitID = new MySqlParameter("@ProductUnitID",MySqlDbType.Int16);
                prmProductUnitID.Value = Details.ProductUnitID;
                cmd.Parameters.Add(prmProductUnitID);

                MySqlParameter prmProductUnitCode = new MySqlParameter("@ProductUnitCode",MySqlDbType.String);
                prmProductUnitCode.Value = Details.ProductUnitCode;
                cmd.Parameters.Add(prmProductUnitCode);

                MySqlParameter prmQuantity = new MySqlParameter("@Quantity",MySqlDbType.Decimal);
                prmQuantity.Value = Details.Quantity;
                cmd.Parameters.Add(prmQuantity);

                MySqlParameter prmUnitCost = new MySqlParameter("@UnitCost",MySqlDbType.Decimal);
                prmUnitCost.Value = Details.UnitCost;
                cmd.Parameters.Add(prmUnitCost);

                MySqlParameter prmDiscount = new MySqlParameter("@Discount",MySqlDbType.Decimal);
                prmDiscount.Value = Details.Discount;
                cmd.Parameters.Add(prmDiscount);

                MySqlParameter prmDiscountApplied = new MySqlParameter("@DiscountApplied",MySqlDbType.Decimal);
                prmDiscountApplied.Value = Details.DiscountApplied;
                cmd.Parameters.Add(prmDiscountApplied);

                MySqlParameter prmDiscountType = new MySqlParameter("@DiscountType",MySqlDbType.Int16);
                prmDiscountType.Value = (int)Details.DiscountType;
                cmd.Parameters.Add(prmDiscountType);

                MySqlParameter prmAmount = new MySqlParameter("@Amount",MySqlDbType.Decimal);
                prmAmount.Value = Details.Amount;
                cmd.Parameters.Add(prmAmount);

                MySqlParameter prmVAT = new MySqlParameter("@VAT",MySqlDbType.Decimal);
                prmVAT.Value = Details.VAT;
                cmd.Parameters.Add(prmVAT);

                MySqlParameter prmVatableAmount = new MySqlParameter("@VatableAmount",MySqlDbType.Decimal);
                prmVatableAmount.Value = Details.VatableAmount;
                cmd.Parameters.Add(prmVatableAmount);

                MySqlParameter prmEVAT = new MySqlParameter("@EVAT",MySqlDbType.Decimal);
                prmEVAT.Value = Details.EVAT;
                cmd.Parameters.Add(prmEVAT);

                MySqlParameter prmEVatableAmount = new MySqlParameter("@EVatableAmount",MySqlDbType.Decimal);
                prmEVatableAmount.Value = Details.EVatableAmount;
                cmd.Parameters.Add(prmEVatableAmount);

                MySqlParameter prmLocalTax = new MySqlParameter("@LocalTax",MySqlDbType.Decimal);
                prmLocalTax.Value = Details.LocalTax;
                cmd.Parameters.Add(prmLocalTax);

                MySqlParameter prmisVATInclusive = new MySqlParameter("@isVATInclusive",MySqlDbType.Int16);
                prmisVATInclusive.Value = Convert.ToInt16(Details.isVATInclusive);
                cmd.Parameters.Add(prmisVATInclusive);

                MySqlParameter prmVariationMatrixID = new MySqlParameter("@VariationMatrixID",MySqlDbType.Int64);
                prmVariationMatrixID.Value = Details.VariationMatrixID;
                cmd.Parameters.Add(prmVariationMatrixID);

                MySqlParameter prmMatrixDescription = new MySqlParameter("@MatrixDescription",MySqlDbType.String);
                prmMatrixDescription.Value = Details.MatrixDescription;
                cmd.Parameters.Add(prmMatrixDescription);

                MySqlParameter prmProductGroup = new MySqlParameter("@ProductGroup",MySqlDbType.String);
                prmProductGroup.Value = Details.ProductGroup;
                cmd.Parameters.Add(prmProductGroup);

                cmd.Parameters.AddWithValue("@ProductSubGroup", Details.ProductSubGroup);
                cmd.Parameters.AddWithValue("@TransferOutItemStatus", Details.TransferOutItemStatus.ToString("d"));
                cmd.Parameters.AddWithValue("@IsVatable", Convert.ToInt16(Details.IsVatable));
                cmd.Parameters.AddWithValue("@Remarks", Details.Remarks);
                cmd.Parameters.AddWithValue("@SellingPrice", Details.SellingPrice);
                cmd.Parameters.AddWithValue("@SellingVAT", Details.SellingVAT);
                cmd.Parameters.AddWithValue("@SellingEVAT", Details.SellingEVAT);
                cmd.Parameters.AddWithValue("@SellingLocalTax", Details.SellingLocalTax);
                cmd.Parameters.AddWithValue("@OldSellingPrice", Details.OldSellingPrice);
                cmd.Parameters.AddWithValue("@TransferOutItemID", Details.TransferOutItemID);

                base.ExecuteNonQuery(cmd);

                TransferOut clsTransferOut = new TransferOut(base.Connection, base.Transaction);
                clsTransferOut.SynchronizeAmount(Details.TransferOutID);
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Beispiel #2
0
        private bool DeleteItems()
        {
            bool boRetValue = false;
            string stIDs = "";

            foreach (DataListItem item in lstItem.Items)
            {
                HtmlInputCheckBox chkList = (HtmlInputCheckBox)item.FindControl("chkList");
                if (chkList != null)
                {
                    if (chkList.Checked == true)
                    {
                        stIDs += chkList.Value + ",";
                        boRetValue = true;
                    }
                }
            }
            if (boRetValue)
            {
                TransferOutItem clsTransferOutItem = new TransferOutItem();
                clsTransferOutItem.Delete(stIDs.Substring(0, stIDs.Length - 1));

                TransferOut clsTransferOut = new TransferOut(clsTransferOutItem.Connection, clsTransferOutItem.Transaction);
                clsTransferOut.SynchronizeAmount(Convert.ToInt64(lblTransferOutID.Text));

                TransferOutDetails clsTransferOutDetails = clsTransferOut.Details(Convert.ToInt64(lblTransferOutID.Text));

                clsTransferOutItem.CommitAndDispose();

                UpdateFooter(clsTransferOutDetails);
            }

            return boRetValue;
        }
Beispiel #3
0
        private void IssueGRN()
        {
            DateTime DeliveryDate = Convert.ToDateTime(txtDeliveryDate.Text);

            ERPConfig clsERPConfig = new ERPConfig();
            ERPConfigDetails clsERPConfigDetails = clsERPConfig.Details();
            clsERPConfig.CommitAndDispose();

            if (clsERPConfigDetails.PostingDateFrom <= DeliveryDate && clsERPConfigDetails.PostingDateTo >= DeliveryDate)
            {
                long TransferOutID = Convert.ToInt64(lblTransferOutID.Text);
                string SupplierDRNo = txtSupplierDRNo.Text;

                TransferOut clsTransferOut = new TransferOut();
                clsTransferOut.IssueGRN(TransferOutID, SupplierDRNo, DeliveryDate);
                clsTransferOut.CommitAndDispose();

                string stParam = "?task=" + Common.Encrypt("list", Session.SessionID) + "&TransferOutid=" + Common.Encrypt(TransferOutID.ToString(), Session.SessionID);
                Response.Redirect("Default.aspx" + stParam);
            }
            else
            {
                string stScript = "<Script>";
                stScript += "window.alert('Sorry you cannot post using the delivery date: " + txtDeliveryDate.Text + ". Please enter an allowable posting date.')";
                stScript += "</Script>";
                Response.Write(stScript);
            }
        }
Beispiel #4
0
        private void LoadRecord()
        {
            Int64 iID = 0;
            try { iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["TransferOutid"], Session.SessionID)); }
            catch { }
            try
            { if (iID == 0) iID = Convert.ToInt64(lblTransferOutID.Text); }
            catch { }

            TransferOut clsTransferOut = new TransferOut();
            TransferOutDetails clsDetails = clsTransferOut.Details(iID);
            clsTransferOut.CommitAndDispose();

            lblTransferOutID.Text = clsDetails.TransferOutID.ToString();
            lnkTransferOutNo.Text = clsDetails.TransferOutNo;
            
            lblTransferOutDate.Text = clsDetails.TransferOutDate.ToString("yyyy-MM-dd HH:mm:ss");
            lblRequiredDeliveryDate.Text = clsDetails.RequiredDeliveryDate.ToString("yyyy-MM-dd");
            //lblRID.Text = clsDetails.RID.ToString();
            lblSupplierID.Text = clsDetails.SupplierID.ToString();

            lblSupplierCode.Text = clsDetails.SupplierCode.ToString();
            lblSupplierCode.NavigateUrl = Constants.ROOT_DIRECTORY + "/PurchasesAndPayables/_Vendor/Default.aspx?task=" + Common.Encrypt("details", Session.SessionID) + "&id=" + Common.Encrypt(clsDetails.SupplierID.ToString(), Session.SessionID);

            lblSupplierContact.Text = clsDetails.SupplierContact;
            lblSupplierTelephoneNo.Text = clsDetails.SupplierTelephoneNo;
            lblTerms.Text = clsDetails.SupplierTerms.ToString("##0");
            switch (clsDetails.SupplierModeOfTerms)
            {
                case 0:
                    lblModeOfterms.Text = "Days";
                    break;
                case 1:
                    lblModeOfterms.Text = "Months";
                    break;
                case 2:
                    lblModeOfterms.Text = "Years";
                    break;
            }
            lblSupplierAddress.Text = clsDetails.SupplierAddress;
            lblBranchID.Text = clsDetails.BranchID.ToString();
            lblBranchCode.Text = clsDetails.BranchCode;
            lblBranchAddress.Text = clsDetails.BranchAddress;
            lblTransferOutRemarks.Text = clsDetails.Remarks;

            txtTransferOutDiscountApplied.Text = clsDetails.DiscountApplied.ToString("###0.#0");
            cboTransferOutDiscountType.SelectedIndex = cboTransferOutDiscountType.Items.IndexOf(cboTransferOutDiscountType.Items.FindByValue(clsDetails.DiscountType.ToString("d")));
            lblTransferOutDiscount.Text = clsDetails.Discount.ToString("#,##0.#0");
            lblTotalDiscount1.Text = Convert.ToDecimal(clsDetails.SubTotal + clsDetails.Discount + clsDetails.Discount2 + clsDetails.Discount3).ToString("#,##0.#0");

            txtTransferOutDiscount2Applied.Text = clsDetails.Discount2Applied.ToString("###0.#0");
            cboTransferOutDiscount2Type.SelectedIndex = cboTransferOutDiscount2Type.Items.IndexOf(cboTransferOutDiscount2Type.Items.FindByValue(clsDetails.Discount2Type.ToString("d")));
            lblTransferOutDiscount2.Text = clsDetails.Discount2.ToString("#,##0.#0");
            lblTotalDiscount2.Text = Convert.ToDecimal(clsDetails.SubTotal + clsDetails.Discount2 + clsDetails.Discount3).ToString("#,##0.#0");

            txtTransferOutDiscount3Applied.Text = clsDetails.Discount3Applied.ToString("###0.#0");
            cboTransferOutDiscount3Type.SelectedIndex = cboTransferOutDiscount3Type.Items.IndexOf(cboTransferOutDiscountType.Items.FindByValue(clsDetails.Discount3Type.ToString("d")));
            lblTransferOutDiscount3.Text = clsDetails.Discount3.ToString("#,##0.#0");
            lblTotalDiscount3.Text = Convert.ToDecimal(clsDetails.SubTotal + clsDetails.Discount3).ToString("#,##0.#0");

            lblTransferOutVatableAmount.Text = clsDetails.VatableAmount.ToString("#,##0.#0");
            txtTransferOutFreight.Text = clsDetails.Freight.ToString("#,##0.#0");
            txtTransferOutDeposit.Text = clsDetails.Deposit.ToString("#,##0.#0");
            lblTransferOutSubTotal.Text = Convert.ToDecimal(clsDetails.SubTotal - clsDetails.VAT).ToString("#,##0.#0");
            lblTransferOutVAT.Text = clsDetails.VAT.ToString("#,##0.#0");
            lblTransferOutTotal.Text = clsDetails.SubTotal.ToString("#,##0.#0");
        }
Beispiel #5
0
        private void SaveRecord()
        {
            TransferOutItemDetails clsDetails = new TransferOutItemDetails();

            Products clsProducts = new Products();
            ProductDetails clsProductDetails = clsProducts.Details1(Constants.BRANCH_ID_MAIN, Convert.ToInt64(cboProductCode.SelectedItem.Value));

            Terminal clsTerminal = new Terminal(clsProducts.Connection, clsProducts.Transaction);
            TerminalDetails clsTerminalDetails = clsTerminal.Details(Int32.Parse(Session["BranchID"].ToString()), Session["TerminalNo"].ToString());
            clsProducts.CommitAndDispose();

            clsDetails.TransferOutID = Convert.ToInt64(lblTransferOutID.Text);
            clsDetails.ProductID = Convert.ToInt64(cboProductCode.SelectedItem.Value);
            clsDetails.ProductCode = clsProductDetails.ProductCode;
            clsDetails.BarCode = clsProductDetails.BarCode;
            clsDetails.Description = clsProductDetails.ProductDesc;
            clsDetails.ProductUnitID = Convert.ToInt32(cboProductUnit.SelectedItem.Value);
            clsDetails.ProductUnitCode = cboProductUnit.SelectedItem.Text;
            clsDetails.Quantity = Convert.ToDecimal(txtQuantity.Text);
            clsDetails.UnitCost = Convert.ToDecimal(txtPrice.Text);
            clsDetails.Discount = getItemTotalDiscount();
            clsDetails.DiscountApplied = Convert.ToDecimal(txtDiscount.Text);
            if (clsDetails.DiscountApplied == 0)
            {
                clsDetails.DiscountType = DiscountTypes.NotApplicable;
            }
            else
            {
                if (chkInPercent.Checked == true)
                    clsDetails.DiscountType = DiscountTypes.Percentage;
                else
                    clsDetails.DiscountType = DiscountTypes.FixedValue;
            }

            clsDetails.IsVatable = chkIsTaxable.Checked;
            clsDetails.Amount = ComputeItemAmount();

            if (clsDetails.IsVatable)
            {
                clsDetails.VatableAmount = clsDetails.Amount;
                clsDetails.EVatableAmount = clsDetails.Amount;
                clsDetails.LocalTax = clsDetails.Amount;

                if (clsTerminalDetails.IsVATInclusive == false)
                {
                    if (clsDetails.VatableAmount < clsDetails.Discount) clsDetails.VatableAmount = 0;
                    if (clsDetails.EVatableAmount < clsDetails.Discount) clsDetails.EVatableAmount = 0;
                    if (clsDetails.LocalTax < clsDetails.Discount) clsDetails.LocalTax = 0;
                }
                else
                {
                    if (clsDetails.VatableAmount >= clsDetails.Discount) clsDetails.VatableAmount = (clsDetails.VatableAmount) / (1 + (clsTerminalDetails.VAT / 100)); else clsDetails.VatableAmount = 0;
                    if (clsDetails.EVatableAmount >= clsDetails.Discount) clsDetails.EVatableAmount = (clsDetails.EVatableAmount) / (1 + (clsTerminalDetails.VAT / 100)); else clsDetails.EVatableAmount = 0;
                    if (clsDetails.LocalTax >= clsDetails.Discount) clsDetails.LocalTax = (clsDetails.LocalTax) / (1 + (clsTerminalDetails.LocalTax / 100)); else clsDetails.LocalTax = 0;
                }

                clsDetails.VAT = clsDetails.VatableAmount * (clsTerminalDetails.VAT / 100);
                clsDetails.EVAT = clsDetails.EVatableAmount * (clsTerminalDetails.EVAT / 100);
                clsDetails.LocalTax = clsDetails.LocalTax * (clsTerminalDetails.LocalTax / 100);

                //if (!clsTerminalDetails.IsVATInclusive) clsDetails.Amount += (clsDetails.VAT + clsDetails.LocalTax);
                //if (!clsTerminalDetails.EnableEVAT) clsDetails.Amount += clsDetails.EVAT;
            }
            else
            {
                clsDetails.VAT = 0;
                clsDetails.VatableAmount = 0;
                clsDetails.EVAT = 0;
                clsDetails.EVatableAmount = 0;
                clsDetails.LocalTax = 0;
            }

            clsDetails.isVATInclusive = clsTerminalDetails.IsVATInclusive;
            clsDetails.VariationMatrixID = Convert.ToInt64(cboVariation.SelectedItem.Value);
            if (clsDetails.VariationMatrixID != 0)
                clsDetails.MatrixDescription = cboVariation.SelectedItem.Text;
            clsDetails.ProductGroup = clsProductDetails.ProductGroupCode;
            clsDetails.ProductSubGroup = clsProductDetails.ProductSubGroupCode;
            clsDetails.Remarks = txtRemarks.Text;

            // Added jan 1, 2010 4:20PM : for selling information
            clsDetails.SellingPrice = decimal.Parse(txtSellingPrice.Text);
            clsDetails.SellingVAT = decimal.Parse(txtVAT.Text);
            clsDetails.SellingEVAT = decimal.Parse(txtEVAT.Text);
            clsDetails.SellingLocalTax = decimal.Parse(txtLocalTax.Text);
            clsDetails.OldSellingPrice = decimal.Parse(txtOldSellingPrice.Text);

            // Aug 9, 2011 : Lemu
            // For Required Inventory Days
            //clsDetails.RID = long.Parse(txtRID.Text);

            TransferOutItem clsTransferOutItem = new TransferOutItem();
            if (lblTransferOutItemID.Text != "0")
            {
                clsDetails.TransferOutItemID = Convert.ToInt64(lblTransferOutItemID.Text);
                clsTransferOutItem.Update(clsDetails);
            }
            else
                clsTransferOutItem.Insert(clsDetails);

            TransferOutDetails clsTransferOutDetails = new TransferOutDetails();
            clsTransferOutDetails.TransferOutID = clsDetails.TransferOutID;
            clsTransferOutDetails.DiscountApplied = Convert.ToDecimal(txtTransferOutDiscountApplied.Text);
            clsTransferOutDetails.DiscountType = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), cboTransferOutDiscountType.SelectedItem.Value);

            clsTransferOutDetails.Discount2Applied = Convert.ToDecimal(txtTransferOutDiscount2Applied.Text);
            clsTransferOutDetails.Discount2Type = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), cboTransferOutDiscount2Type.SelectedItem.Value);

            clsTransferOutDetails.Discount3Applied = Convert.ToDecimal(txtTransferOutDiscount3Applied.Text);
            clsTransferOutDetails.Discount3Type = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), cboTransferOutDiscount3Type.SelectedItem.Value);

            TransferOut clsTransferOut = new TransferOut(clsTransferOutItem.Connection, clsTransferOutItem.Transaction);
            clsTransferOut.UpdateDiscount(clsDetails.TransferOutID, clsTransferOutDetails.DiscountApplied, clsTransferOutDetails.DiscountType, clsTransferOutDetails.Discount2Applied, clsTransferOutDetails.Discount2Type, clsTransferOutDetails.Discount3Applied, clsTransferOutDetails.Discount3Type);

            clsTransferOutDetails = clsTransferOut.Details(clsDetails.TransferOutID);
            clsTransferOutItem.CommitAndDispose();

            UpdateFooter(clsTransferOutDetails);
        }
Beispiel #6
0
		private void LoadRecord()
		{
            Int64 iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["transferoutid"], Session.SessionID));
			TransferOut clsTransferOut = new TransferOut();
			TransferOutDetails clsDetails = clsTransferOut.Details(iID);
			clsTransferOut.CommitAndDispose();

			lblTransferOutID.Text = clsDetails.TransferOutID.ToString();
			lblTransferOutNo.Text = clsDetails.TransferOutNo;
			lblTransferOutDate.Text = clsDetails.TransferOutDate.ToString("yyyy-MM-dd HH:mm:ss");
			txtRequiredDeliveryDate.Text = clsDetails.RequiredDeliveryDate.ToString("yyyy-MM-dd");
			cboSupplier.SelectedIndex = cboSupplier.Items.IndexOf(cboSupplier.Items.FindByValue(clsDetails.SupplierID.ToString()));
			txtSupplierContact.Text = clsDetails.SupplierContact;
			txtSupplierTelephoneNo.Text = clsDetails.SupplierTelephoneNo;
			lblTerms.Text = clsDetails.SupplierTerms.ToString("##0");
			switch (clsDetails.SupplierModeOfTerms)
			{
				case 0: 
					lblModeOfterms.Text = "Days"; 
					break;
				case 1:
					lblModeOfterms.Text = "Months"; 
					break;
				case 2:
					lblModeOfterms.Text = "Years"; 
					break;
			}
			txtSupplierAddress.Text = clsDetails.SupplierAddress;
			cboBranch.SelectedIndex = cboBranch.Items.IndexOf(cboBranch.Items.FindByValue(clsDetails.BranchID.ToString()));
			txtBranchAddress.Text = clsDetails.BranchAddress;
			txtRemarks.Text = clsDetails.Remarks;
		}
Beispiel #7
0
        protected void chkIsVatInclusive_CheckedChanged(object sender, EventArgs e)
        {
            try
            {
                long TransferOutID = long.Parse(lblTransferOutID.Text);

                TransferOut clsTransferOut = new TransferOut();
                clsTransferOut.UpdateIsVatInclusive(TransferOutID, chkIsVatInclusive.Checked);

                TransferOutDetails clsTransferOutDetails = clsTransferOut.Details(TransferOutID);
                clsTransferOut.CommitAndDispose();

                UpdateFooter(clsTransferOutDetails);
            }
            catch (Exception ex) { throw ex; }
        }
Beispiel #8
0
        private void UpdateTransferOutDiscount()
        {
            TransferOutDetails clsTransferOutDetails = new TransferOutDetails();
            clsTransferOutDetails.TransferOutID = Convert.ToInt64(lblTransferOutID.Text);
            clsTransferOutDetails.DiscountApplied = Convert.ToDecimal(txtTransferOutDiscountApplied.Text);
            clsTransferOutDetails.DiscountType = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), cboTransferOutDiscountType.SelectedItem.Value);

            clsTransferOutDetails.Discount2Applied = Convert.ToDecimal(txtTransferOutDiscount2Applied.Text);
            clsTransferOutDetails.Discount2Type = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), cboTransferOutDiscount2Type.SelectedItem.Value);

            clsTransferOutDetails.Discount3Applied = Convert.ToDecimal(txtTransferOutDiscount3Applied.Text);
            clsTransferOutDetails.Discount3Type = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), cboTransferOutDiscount3Type.SelectedItem.Value);

            TransferOut clsTransferOut = new TransferOut();
            clsTransferOut.UpdateDiscount(clsTransferOutDetails.TransferOutID, clsTransferOutDetails.DiscountApplied, clsTransferOutDetails.DiscountType, clsTransferOutDetails.Discount2Applied, clsTransferOutDetails.Discount2Type, clsTransferOutDetails.Discount3Applied, clsTransferOutDetails.Discount3Type);
            clsTransferOut.SynchronizeAmount(Convert.ToInt64(lblTransferOutID.Text));
            clsTransferOutDetails = clsTransferOut.Details(Convert.ToInt64(lblTransferOutID.Text));
            clsTransferOut.CommitAndDispose();

            UpdateFooter(clsTransferOutDetails);
        }
Beispiel #9
0
        private void UpdateDeposit()
        {
            TransferOutDetails clsTransferOutDetails = new TransferOutDetails();
            clsTransferOutDetails.TransferOutID = Convert.ToInt64(lblTransferOutID.Text);
            clsTransferOutDetails.Deposit = Convert.ToDecimal(txtTransferOutDeposit.Text);

            TransferOut clsTransferOut = new TransferOut();
            clsTransferOut.UpdateDeposit(clsTransferOutDetails.TransferOutID, clsTransferOutDetails.Deposit);
            clsTransferOut.SynchronizeAmount(Convert.ToInt64(lblTransferOutID.Text));
            clsTransferOutDetails = clsTransferOut.Details(Convert.ToInt64(lblTransferOutID.Text));
            clsTransferOut.CommitAndDispose();

            UpdateFooter(clsTransferOutDetails);
        }
Beispiel #10
0
        private void CancelTransferOut()
        {
            long TransferOutID = Convert.ToInt64(lblTransferOutID.Text);
            string Remarks = txtRemarks.Text;

            TransferOut clsTransferOut = new TransferOut();
            clsTransferOut.Cancel(TransferOutID, DateTime.Now, Remarks, Convert.ToInt64(Session["UID"].ToString()));
            clsTransferOut.CommitAndDispose();

            Response.Redirect("Default.aspx?task=" + Common.Encrypt("list", Session.SessionID));
        }
Beispiel #11
0
 private void GenerateItems()
 {
     TransferOut clsTransferOut = new TransferOut();
     clsTransferOut.GenerateItemsForReorder(Int32.Parse(Session["TerminalID"].ToString()), Convert.ToInt64(lblTransferOutID.Text));
     clsTransferOut.CommitAndDispose();
 }
Beispiel #12
0
		private void LoadList()
		{	
			TransferOut clsTransferOut = new TransferOut();
			DataClass clsDataClass = new DataClass();
			Common Common = new Common();

			string SortField = "TransferOutID";
			if (Request.QueryString["sortfield"]!=null)
			{	SortField = Common.Decrypt(Request.QueryString["sortfield"].ToString(), Session.SessionID);	}

			SortOption sortoption = SortOption.Ascending;
			if (Request.QueryString["sortoption"]!=null)
			{	sortoption = (SortOption) Enum.Parse(typeof(SortOption), Common.Decrypt(Request.QueryString["sortoption"], Session.SessionID), true);	}

            DateTime dteTransferStartDate = DateTime.MinValue;
            try { if (txtOrderStartDate.Text != string.Empty) dteTransferStartDate = Convert.ToDateTime(txtOrderStartDate.Text + " " + txtOrderStartTime.Text); }
            catch { }

            DateTime dteTransferEndDate = DateTime.MinValue;
            try { if (txtOrderEndDate.Text != string.Empty) dteTransferEndDate = Convert.ToDateTime(txtOrderEndDate.Text + " " + txtOrderEndTime.Text); }
            catch { }

            DateTime dtePostingStartDate = DateTime.MinValue;
            try { if (txtPostingStartDate.Text != string.Empty) dtePostingStartDate = Convert.ToDateTime(txtPostingStartDate.Text + " " + txtPostingStartTime.Text); }
            catch { }

            DateTime dtePostingEndDate = DateTime.MinValue;
            try { if (txtPostingEndDate.Text != string.Empty) dtePostingEndDate = Convert.ToDateTime(txtPostingEndDate.Text + " " + txtPostingEndTime.Text); }
            catch { }

            string SearchKey = txtSearch.Text;
            TransferOutStatus status = (TransferOutStatus)Enum.Parse(typeof(TransferOutStatus), cboStatus.SelectedItem.Value);
            PageData.DataSource = clsTransferOut.SearchAsDataTable(status, dteTransferStartDate, dteTransferEndDate, dtePostingStartDate, dtePostingEndDate, SearchKey, SortField, sortoption).DefaultView;

			clsTransferOut.CommitAndDispose();

			int iPageSize = Convert.ToInt16(Session["PageSize"]) ;
			
			PageData.AllowPaging = true;
			PageData.PageSize = iPageSize;
			try
			{
				PageData.CurrentPageIndex = Convert.ToInt16(cboCurrentPage.SelectedItem.Value) - 1;				
				lstItem.DataSource = PageData;
				lstItem.DataBind();
			}
			catch
			{
				PageData.CurrentPageIndex = 1;
				lstItem.DataSource = PageData;
				lstItem.DataBind();
			}			
			
			cboCurrentPage.Items.Clear();
			for (int i=0; i < PageData.PageCount;i++)
			{
				int iValue = i + 1;
				cboCurrentPage.Items.Add(new ListItem(iValue.ToString(),iValue.ToString()));
				if (PageData.CurrentPageIndex == i)
				{	cboCurrentPage.Items[i].Selected = true;}
				else
				{	cboCurrentPage.Items[i].Selected = false;}
			}
			lblDataCount.Text = " of " + " " + PageData.PageCount;
		}
Beispiel #13
0
        private void ExportToFile()
        {

            TransferOut clsTransferOut = new TransferOut();
            TransferOutDetails clsTransferOutDetails = clsTransferOut.Details(long.Parse(lblTransferOutID.Text));

            TransferOutItem clsTransferOutItem = new TransferOutItem(clsTransferOut.Connection, clsTransferOut.Transaction);
            DataTable dtaTransferOutItems = clsTransferOutItem.ListAsDataTable(clsTransferOutDetails.TransferOutID, null, SortOption.Ascending);

            Branch clsBranch = new Branch(clsTransferOut.Connection, clsTransferOut.Transaction);
            BranchDetails clsBranchDetails;

            Contacts clsContact = new Contacts(clsTransferOut.Connection, clsTransferOut.Transaction);
            ContactDetails clsContactDetails;

            Products clsProduct = new Products(clsTransferOut.Connection, clsTransferOut.Transaction);
            ProductDetails clsProductDetails;

            ProductVariations clsProductVariation = new ProductVariations(clsTransferOut.Connection, clsTransferOut.Transaction);
            DataTable dtaProductVariation;

            ProductVariationsMatrix clsProductVariationsMatrix = new ProductVariationsMatrix(clsTransferOut.Connection, clsTransferOut.Transaction);
            DataTable dtaProductVariationsMatrix;

            string xmlFileName = Server.MapPath(@"\RetailPlus\temp\" + lblBranchCode.Text.Replace(" ", "").Trim() + "_" + clsTransferOutDetails.TransferOutNo + "_" + clsTransferOutDetails.TransferOutDate.ToString("yyyyMMddHHmmssffff") + ".xml");
            XmlTextWriter writer = new XmlTextWriter(xmlFileName, System.Text.Encoding.UTF8);

            writer.Formatting = Formatting.Indented;
            writer.WriteStartDocument();
            writer.WriteComment("This file represents the TransferOut Details of TransferOut No: '" + clsTransferOutDetails.TransferOutNo + "' for " + lblBranchCode.Text + " branch.");
            writer.WriteComment("Save this in your local file. Goto 'File', click 'Save As', select the location in your local directory, click 'Save'.");
            writer.WriteStartElement("TransferOutDetails");
            writer.WriteAttributeString("TransferOutID", XmlConvert.ToString(clsTransferOutDetails.TransferOutID));
            writer.WriteAttributeString("TransferOutNo", clsTransferOutDetails.TransferOutNo);
            writer.WriteAttributeString("TransferOutDate", clsTransferOutDetails.TransferOutDate.ToString("MM/dd/yyyy HH:mm:ss"));

            /******Supplier information******/
            clsContactDetails = clsContact.Details(clsTransferOutDetails.SupplierID);
            writer.WriteAttributeString("SupplierID", XmlConvert.ToString(clsContactDetails.ContactID));
            writer.WriteAttributeString("SupplierCode", clsContactDetails.ContactCode);
            writer.WriteAttributeString("SupplierName", clsContactDetails.ContactName);
            writer.WriteAttributeString("SupplierContact", clsContactDetails.BusinessName);
            writer.WriteAttributeString("SupplierAddress", clsTransferOutDetails.SupplierAddress);
            writer.WriteAttributeString("SupplierTelephoneNo", clsTransferOutDetails.SupplierTelephoneNo);
            writer.WriteAttributeString("SupplierModeOfTerms", XmlConvert.ToString(clsTransferOutDetails.SupplierModeOfTerms));
            writer.WriteAttributeString("SupplierTerms", XmlConvert.ToString(clsTransferOutDetails.SupplierTerms));
            writer.WriteAttributeString("SupplierContactGroupName", clsContactDetails.ContactGroupName);
            /******End Of Supplier Information******/

            writer.WriteAttributeString("RequiredDeliveryDate", clsTransferOutDetails.RequiredDeliveryDate.ToString("MM/dd/yyyy HH:mm:ss"));

            /******Branch & Transferrer Information******/
            clsBranchDetails = clsBranch.Details(short.Parse(clsTransferOutDetails.BranchID.ToString()));
            writer.WriteAttributeString("BranchID", XmlConvert.ToString(clsTransferOutDetails.BranchID));
            writer.WriteAttributeString("BranchCode", clsTransferOutDetails.BranchCode);
            writer.WriteAttributeString("BranchName", clsTransferOutDetails.BranchName);
            writer.WriteAttributeString("BranchAddress", clsTransferOutDetails.BranchAddress);
            writer.WriteAttributeString("BranchDBIP", clsBranchDetails.DBIP);
            writer.WriteAttributeString("BranchDBPort", clsBranchDetails.DBPort);
            writer.WriteAttributeString("BranchRemarks", clsBranchDetails.Remarks);
            writer.WriteAttributeString("TransferrerID", clsTransferOutDetails.TransferrerID.ToString());
            writer.WriteAttributeString("TransferrerName", clsTransferOutDetails.TransferrerName);
            /******End Of Branch & Transferrer Information******/

            /******Amount Information******/
            writer.WriteAttributeString("SubTotal", XmlConvert.ToString(clsTransferOutDetails.SubTotal));
            writer.WriteAttributeString("Discount", XmlConvert.ToString(clsTransferOutDetails.Discount));
            writer.WriteAttributeString("DiscountApplied", XmlConvert.ToString(clsTransferOutDetails.DiscountApplied));
            writer.WriteAttributeString("DiscountType", clsTransferOutDetails.DiscountType.ToString("d"));
            writer.WriteAttributeString("VAT", XmlConvert.ToString(clsTransferOutDetails.VAT));
            writer.WriteAttributeString("VatableAmount", XmlConvert.ToString(clsTransferOutDetails.VatableAmount));
            writer.WriteAttributeString("EVAT", XmlConvert.ToString(clsTransferOutDetails.EVAT));
            writer.WriteAttributeString("EVatableAmount", XmlConvert.ToString(clsTransferOutDetails.EVatableAmount));
            writer.WriteAttributeString("LocalTax", XmlConvert.ToString(clsTransferOutDetails.LocalTax));
            writer.WriteAttributeString("Freight", XmlConvert.ToString(clsTransferOutDetails.Freight));
            writer.WriteAttributeString("Deposit", XmlConvert.ToString(clsTransferOutDetails.Deposit));
            writer.WriteAttributeString("UnpaidAmount", XmlConvert.ToString(clsTransferOutDetails.UnpaidAmount));
            writer.WriteAttributeString("PaidAmount", XmlConvert.ToString(clsTransferOutDetails.PaidAmount));
            writer.WriteAttributeString("TotalItemDiscount", XmlConvert.ToString(clsTransferOutDetails.TotalItemDiscount));
            writer.WriteAttributeString("Status", clsTransferOutDetails.Status.ToString("d"));
            writer.WriteAttributeString("Remarks", clsTransferOutDetails.Remarks);
            writer.WriteAttributeString("SupplierDRNo", clsTransferOutDetails.SupplierDRNo);
            writer.WriteAttributeString("DeliveryDate", clsTransferOutDetails.DeliveryDate.ToString("MM/dd/yyyy HH:mm:ss"));
            writer.WriteAttributeString("CancelledDate", clsTransferOutDetails.CancelledDate.ToString("MM/dd/yyyy HH:mm:ss"));
            writer.WriteAttributeString("CancelledRemarks", clsTransferOutDetails.CancelledRemarks);
            writer.WriteAttributeString("CancelledByID", XmlConvert.ToString(clsTransferOutDetails.CancelledByID));
            /******End Of Branch Information******/

            foreach (DataRow row in dtaTransferOutItems.Rows)
            {
                clsProductDetails = new ProductDetails();
                clsProductDetails = clsProduct.Details(Convert.ToInt64(row["ProductID"].ToString()));

                writer.WriteStartElement("TransferOutItem");
                writer.WriteAttributeString("TransferOutItemID", row["TransferOutItemID"].ToString());
                writer.WriteAttributeString("TransferOutID", row["TransferOutID"].ToString());
                writer.WriteAttributeString("ProductID", row["ProductID"].ToString());

                /*****Product Information*****/
                writer.WriteAttributeString("ProductCode", clsProductDetails.ProductCode);
                writer.WriteAttributeString("BarCode", clsProductDetails.BarCode);
                writer.WriteAttributeString("ProductDesc", clsProductDetails.ProductDesc);
                writer.WriteAttributeString("MatrixDescription", row["MatrixDescription"].ToString());
                writer.WriteAttributeString("ProductSubGroupID", clsProductDetails.ProductSubGroupID.ToString());
                writer.WriteAttributeString("ProductSubGroupCode", clsProductDetails.ProductSubGroupCode);
                writer.WriteAttributeString("ProductSubGroupName", clsProductDetails.ProductSubGroupName);
                writer.WriteAttributeString("ProductGroupID", clsProductDetails.ProductGroupID.ToString());
                writer.WriteAttributeString("ProductGroupCode", clsProductDetails.ProductGroupCode);
                writer.WriteAttributeString("ProductGroupName", clsProductDetails.ProductGroupName);
                writer.WriteAttributeString("BaseUnitID", clsProductDetails.BaseUnitID.ToString());
                writer.WriteAttributeString("BaseUnitCode", clsProductDetails.BaseUnitCode);
                writer.WriteAttributeString("BaseUnitName", clsProductDetails.BaseUnitName);
                writer.WriteAttributeString("DateCreated", clsProductDetails.DateCreated.ToString("MM/dd/yy HH:mm:ss"));
                writer.WriteAttributeString("Deleted", clsProductDetails.Deleted.ToString());
                writer.WriteAttributeString("Price", clsProductDetails.Price.ToString());
                writer.WriteAttributeString("PurchasePrice", clsProductDetails.PurchasePrice.ToString());
                writer.WriteAttributeString("IncludeInSubtotalDiscount", clsProductDetails.IncludeInSubtotalDiscount.ToString());
                writer.WriteAttributeString("VAT", clsProductDetails.VAT.ToString());
                writer.WriteAttributeString("EVAT", clsProductDetails.EVAT.ToString());
                writer.WriteAttributeString("LocalTax", clsProductDetails.LocalTax.ToString());
                writer.WriteAttributeString("Quantity", clsProductDetails.Quantity.ToString());
                writer.WriteAttributeString("MinThreshold", clsProductDetails.MinThreshold.ToString());
                writer.WriteAttributeString("MaxThreshold", clsProductDetails.MaxThreshold.ToString());
                writer.WriteAttributeString("ChartOfAccountIDPurchase", clsProductDetails.ChartOfAccountIDPurchase.ToString());
                writer.WriteAttributeString("ChartOfAccountIDSold", clsProductDetails.ChartOfAccountIDSold.ToString());
                writer.WriteAttributeString("ChartOfAccountIDInventory", clsProductDetails.ChartOfAccountIDInventory.ToString());
                writer.WriteAttributeString("ChartOfAccountIDTaxPurchase", clsProductDetails.ChartOfAccountIDTaxPurchase.ToString());
                writer.WriteAttributeString("ChartOfAccountIDTaxSold", clsProductDetails.ChartOfAccountIDTaxSold.ToString());
                writer.WriteAttributeString("IsItemSold", clsProductDetails.IsItemSold.ToString());
                writer.WriteAttributeString("WillPrintProductComposition", clsProductDetails.WillPrintProductComposition.ToString());
                writer.WriteAttributeString("UpdatedBy", clsProductDetails.UpdatedBy.ToString());
                writer.WriteAttributeString("UpdatedOn", clsProductDetails.UpdatedOn.ToString("MM/dd/yyyy HH:mm"));
                writer.WriteAttributeString("PercentageCommision", clsProductDetails.PercentageCommision.ToString());
                writer.WriteAttributeString("Active", clsProductDetails.Active.ToString());
                /*****End Of Product Information*****/

                writer.WriteAttributeString("ItemProductGroup", row["ProductGroup"].ToString());
                writer.WriteAttributeString("ItemProductSubGroup", row["ProductSubGroup"].ToString());
                writer.WriteAttributeString("ItemVariationMatrixID", row["VariationMatrixID"].ToString());
                writer.WriteAttributeString("ItemBaseVariationDescription", row["MatrixDescription"].ToString());
                writer.WriteAttributeString("ItemProductUnitID", row["ProductUnitID"].ToString());
                writer.WriteAttributeString("ItemProductUnitCode", row["ProductUnitCode"].ToString());
                writer.WriteAttributeString("ItemQuantity", row["Quantity"].ToString());
                writer.WriteAttributeString("ItemUnitCost", row["UnitCost"].ToString());
                writer.WriteAttributeString("ItemDiscount", row["Discount"].ToString());
                writer.WriteAttributeString("ItemDiscountApplied", row["DiscountApplied"].ToString());
                writer.WriteAttributeString("ItemDiscountType", row["DiscountType"].ToString());
                writer.WriteAttributeString("ItemAmount", row["Amount"].ToString());
                writer.WriteAttributeString("ItemVAT", row["VAT"].ToString());
                writer.WriteAttributeString("ItemVatableAmount", row["VatableAmount"].ToString());
                writer.WriteAttributeString("ItemEVAT", row["EVAT"].ToString());
                writer.WriteAttributeString("ItemEVatableAmount", row["EVatableAmount"].ToString());
                writer.WriteAttributeString("ItemLocalTax", row["LocalTax"].ToString());
                writer.WriteAttributeString("ItemisVATInclusive", row["isVATInclusive"].ToString());
                writer.WriteAttributeString("ItemTransferOutItemStatus", row["TransferOutItemStatus"].ToString());
                writer.WriteAttributeString("ItemIsVatable", row["IsVatable"].ToString());
                writer.WriteAttributeString("ItemSellingPrice", row["SellingPrice"].ToString());
                writer.WriteAttributeString("ItemSellingVAT", row["SellingVAT"].ToString());
                writer.WriteAttributeString("ItemSellingEVAT", row["SellingEVAT"].ToString());
                writer.WriteAttributeString("ItemSellingLocalTax", row["SellingLocalTax"].ToString());
                writer.WriteAttributeString("ItemOldSellingPrice", row["OldSellingPrice"].ToString());
                writer.WriteAttributeString("ItemRemarks", row["Remarks"].ToString());

                dtaProductVariation = clsProductVariation.ListAsDataTable(clsProductDetails.ProductID, null, System.Data.SqlClient.SortOrder.Ascending);
                foreach (DataRow rowVariation in dtaProductVariation.Rows)
                {
                    writer.WriteStartElement("Variation", null);
                    writer.WriteAttributeString("VariationCode", rowVariation["VariationCode"].ToString());
                    writer.WriteAttributeString("VariationType", rowVariation["VariationType"].ToString());
                    writer.WriteEndElement();
                }

                dtaProductVariationsMatrix = clsProductVariationsMatrix.ProductVariationsMatrixListAsDataTable(long.Parse(row["VariationMatrixID"].ToString()), null, System.Data.SqlClient.SortOrder.Ascending);
                foreach (DataRow rowVariationsMatrix in dtaProductVariationsMatrix.Rows)
                {
                    writer.WriteStartElement("VariationMatrix", null);
                    writer.WriteAttributeString("MatriXID", rowVariationsMatrix["MatriXID"].ToString());
                    writer.WriteAttributeString("VariationID", rowVariationsMatrix["VariationID"].ToString());
                    writer.WriteAttributeString("Description", rowVariationsMatrix["Description"].ToString());
                    writer.WriteAttributeString("VariationCode", rowVariationsMatrix["VariationCode"].ToString());
                    writer.WriteAttributeString("VariationType", rowVariationsMatrix["VariationType"].ToString());
                    writer.WriteEndElement();
                }

                writer.WriteEndElement();
            }

            writer.WriteEndElement();

            //Write the XML to file and close the writer
            writer.Flush();
            writer.Close();

            clsTransferOut.CommitAndDispose();

            string stScript = "<Script>";
            stScript += "window.open('/RetailPlus/temp/" + lblBranchCode.Text.Replace(" ", "").Trim() + "_" + clsTransferOutDetails.TransferOutNo + "_" + clsTransferOutDetails.TransferOutDate.ToString("yyyyMMddHHmmssffff") + ".xml')";
            stScript += "</Script>";
            Response.Write(stScript);
        }
Beispiel #14
0
		private void SaveRecord()
		{
			TransferOutDetails clsDetails = new TransferOutDetails();

			clsDetails.TransferOutID = Convert.ToInt64(lblTransferOutID.Text);
			clsDetails.TransferOutNo = lblTransferOutNo.Text;
			clsDetails.TransferOutDate = Convert.ToDateTime(lblTransferOutDate.Text);
			clsDetails.SupplierID = Convert.ToInt64(cboSupplier.SelectedItem.Value);
			clsDetails.SupplierCode = cboSupplier.SelectedItem.Text;
			clsDetails.SupplierContact = txtSupplierContact.Text;
			clsDetails.SupplierAddress = txtSupplierAddress.Text;
			clsDetails.SupplierTelephoneNo = txtSupplierTelephoneNo.Text;
			switch (lblModeOfterms.Text)
			{
				case "Days":
					clsDetails.SupplierModeOfTerms = 0;
					break;
				case "Months":
					clsDetails.SupplierModeOfTerms = 1;
					break;
				case "Years":
					clsDetails.SupplierModeOfTerms = 2;
					break;
			}
			clsDetails.RequiredDeliveryDate = Convert.ToDateTime(txtRequiredDeliveryDate.Text);
			clsDetails.BranchID = Convert.ToInt16(cboBranch.SelectedItem.Value);
			clsDetails.TransferrerID = Convert.ToInt64(Session["UID"].ToString());
            clsDetails.TransferrerName = Session["Name"].ToString();
			clsDetails.Status = TransferOutStatus.Open;
			clsDetails.Remarks = txtRemarks.Text;

			TransferOut clsTransferOut = new TransferOut();
			clsTransferOut.Update(clsDetails);
			clsTransferOut.CommitAndDispose();
		}
Beispiel #15
0
        public long Insert(TransferOutItemDetails Details)
        {
            try
            {
                string SQL = "INSERT INTO tblTransferOutItems (" +
                                "TransferOutID, " +
                                "ProductID, " +
                                "ProductCode, " +
                                "BarCode, " +
                                "Description, " +
                                "ProductUnitID, " +
                                "ProductUnitCode, " +
                                "Quantity, " +
                                "OriginalQuantity, " +
                                "UnitCost, " +
                                "Discount, " +
                                "DiscountApplied, " +
                                "DiscountType, " +
                                "Amount, " +
                                "VAT, " +
                                "VatableAmount, " +
                                "EVAT, " +
                                "EVatableAmount, " +
                                "LocalTax, " +
                                "isVATInclusive, " +
                                "VariationMatrixID, " +
                                "MatrixDescription, " +
                                "ProductGroup, " +
                                "ProductSubGroup, " +
                                "TransferOutItemStatus, " +
                                "IsVatable, " +
                                "Remarks, " +
                                "ChartOfAccountIDTransferOut, " +
                                "ChartOfAccountIDTaxTransferOut, " +
                                "ChartOfAccountIDInventory," +
                                "SellingPrice," +
                                "SellingVAT," +
                                "SellingEVAT," +
                                "SellingLocalTax," +
                                "OldSellingPrice" +
                            ") VALUES (" +
                                "@TransferOutID, " +
                                "@ProductID, " +
                                "@ProductCode, " +
                                "@BarCode, " +
                                "@Description, " +
                                "@ProductUnitID, " +
                                "@ProductUnitCode, " +
                                "@Quantity, " +
                                "@Quantity, " +
                                "@UnitCost, " +
                                "@Discount, " +
                                "@DiscountApplied, " +
                                "@DiscountType, " +
                                "@Amount, " +
                                "@VAT, " +
                                "@VatableAmount, " +
                                "@EVAT, " +
                                "@EVatableAmount, " +
                                "@LocalTax, " +
                                "@isVATInclusive, " +
                                "@VariationMatrixID, " +
                                "@MatrixDescription, " +
                                "@ProductGroup, " +
                                "@ProductSubGroup, " +
                                "@TransferOutItemStatus, " +
                                "@IsVatable, " +
                                "@Remarks, " +
                                "(SELECT ChartOfAccountIDTransferOut FROM tblProducts WHERE ProductID = @ProductID), " +
                                "(SELECT ChartOfAccountIDTaxTransferOut FROM tblProducts WHERE ProductID = @ProductID), " +
                                "(SELECT ChartOfAccountIDInventory FROM tblProducts WHERE ProductID = @ProductID)," +
                                "@SellingPrice," +
                                "@SellingVAT," +
                                "@SellingEVAT," +
                                "@SellingLocalTax," +
                                "@OldSellingPrice" +
                            ");";

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

                MySqlParameter prmTransferOutID = new MySqlParameter("@TransferOutID",MySqlDbType.Int64);
                prmTransferOutID.Value = Details.TransferOutID;
                cmd.Parameters.Add(prmTransferOutID);

                MySqlParameter prmProductID = new MySqlParameter("@ProductID",MySqlDbType.Int64);
                prmProductID.Value = Details.ProductID;
                cmd.Parameters.Add(prmProductID);

                MySqlParameter prmProductCode = new MySqlParameter("@ProductCode",MySqlDbType.String);
                prmProductCode.Value = Details.ProductCode;
                cmd.Parameters.Add(prmProductCode);

                MySqlParameter prmBarCode = new MySqlParameter("@BarCode",MySqlDbType.String);
                prmBarCode.Value = Details.BarCode;
                cmd.Parameters.Add(prmBarCode);

                MySqlParameter prmDescription = new MySqlParameter("@Description",MySqlDbType.String);
                prmDescription.Value = Details.Description;
                cmd.Parameters.Add(prmDescription);

                MySqlParameter prmProductUnitID = new MySqlParameter("@ProductUnitID",MySqlDbType.Int16);
                prmProductUnitID.Value = Details.ProductUnitID;
                cmd.Parameters.Add(prmProductUnitID);

                MySqlParameter prmProductUnitCode = new MySqlParameter("@ProductUnitCode",MySqlDbType.String);
                prmProductUnitCode.Value = Details.ProductUnitCode;
                cmd.Parameters.Add(prmProductUnitCode);

                MySqlParameter prmQuantity = new MySqlParameter("@Quantity",MySqlDbType.Decimal);
                prmQuantity.Value = Details.Quantity;
                cmd.Parameters.Add(prmQuantity);

                MySqlParameter prmUnitCost = new MySqlParameter("@UnitCost",MySqlDbType.Decimal);
                prmUnitCost.Value = Details.UnitCost;
                cmd.Parameters.Add(prmUnitCost);

                MySqlParameter prmDiscount = new MySqlParameter("@Discount",MySqlDbType.Decimal);
                prmDiscount.Value = Details.Discount;
                cmd.Parameters.Add(prmDiscount);

                MySqlParameter prmDiscountApplied = new MySqlParameter("@DiscountApplied",MySqlDbType.Decimal);
                prmDiscountApplied.Value = Details.DiscountApplied;
                cmd.Parameters.Add(prmDiscountApplied);

                MySqlParameter prmDiscountType = new MySqlParameter("@DiscountType",MySqlDbType.Int16);
                prmDiscountType.Value = (int)Details.DiscountType;
                cmd.Parameters.Add(prmDiscountType);

                MySqlParameter prmAmount = new MySqlParameter("@Amount",MySqlDbType.Decimal);
                prmAmount.Value = Details.Amount;
                cmd.Parameters.Add(prmAmount);

                MySqlParameter prmVAT = new MySqlParameter("@VAT",MySqlDbType.Decimal);
                prmVAT.Value = Details.VAT;
                cmd.Parameters.Add(prmVAT);

                MySqlParameter prmVatableAmount = new MySqlParameter("@VatableAmount",MySqlDbType.Decimal);
                prmVatableAmount.Value = Details.VatableAmount;
                cmd.Parameters.Add(prmVatableAmount);

                MySqlParameter prmEVAT = new MySqlParameter("@EVAT",MySqlDbType.Decimal);
                prmEVAT.Value = Details.EVAT;
                cmd.Parameters.Add(prmEVAT);

                MySqlParameter prmEVatableAmount = new MySqlParameter("@EVatableAmount",MySqlDbType.Decimal);
                prmEVatableAmount.Value = Details.EVatableAmount;
                cmd.Parameters.Add(prmEVatableAmount);

                MySqlParameter prmLocalTax = new MySqlParameter("@LocalTax",MySqlDbType.Decimal);
                prmLocalTax.Value = Details.LocalTax;
                cmd.Parameters.Add(prmLocalTax);

                MySqlParameter prmisVATInclusive = new MySqlParameter("@isVATInclusive",MySqlDbType.Int16);
                prmisVATInclusive.Value = Convert.ToInt16(Details.isVATInclusive);
                cmd.Parameters.Add(prmisVATInclusive);

                MySqlParameter prmVariationMatrixID = new MySqlParameter("@VariationMatrixID",MySqlDbType.Int64);
                prmVariationMatrixID.Value = Details.VariationMatrixID;
                cmd.Parameters.Add(prmVariationMatrixID);

                MySqlParameter prmMatrixDescription = new MySqlParameter("@MatrixDescription",MySqlDbType.String);
                prmMatrixDescription.Value = Details.MatrixDescription;
                cmd.Parameters.Add(prmMatrixDescription);

                MySqlParameter prmProductGroup = new MySqlParameter("@ProductGroup",MySqlDbType.String);
                prmProductGroup.Value = Details.ProductGroup;
                cmd.Parameters.Add(prmProductGroup);

                MySqlParameter prmProductSubGroup = new MySqlParameter("@ProductSubGroup",MySqlDbType.String);
                prmProductSubGroup.Value = Details.ProductSubGroup;
                cmd.Parameters.Add(prmProductSubGroup);

                MySqlParameter prmTransferOutItemStatus = new MySqlParameter("@TransferOutItemStatus",MySqlDbType.Int16);
                prmTransferOutItemStatus.Value = Details.TransferOutItemStatus.ToString("d");
                cmd.Parameters.Add(prmTransferOutItemStatus);

                MySqlParameter prmIsVatable = new MySqlParameter("@IsVatable",MySqlDbType.Int16);
                prmIsVatable.Value = Convert.ToInt16(Details.IsVatable);
                cmd.Parameters.Add(prmIsVatable);

                MySqlParameter prmRemarks = new MySqlParameter("@Remarks",MySqlDbType.String);
                prmRemarks.Value = Details.Remarks;
                cmd.Parameters.Add(prmRemarks);

                cmd.Parameters.AddWithValue("@SellingPrice", Details.SellingPrice);
                cmd.Parameters.AddWithValue("@SellingVAT", Details.SellingVAT);
                cmd.Parameters.AddWithValue("@SellingEVAT", Details.SellingEVAT);
                cmd.Parameters.AddWithValue("@SellingLocalTax", Details.SellingLocalTax);
                cmd.Parameters.AddWithValue("@OldSellingPrice", Details.OldSellingPrice);

                base.ExecuteNonQuery(cmd);

                SQL = "SELECT LAST_INSERT_ID();";

                cmd.Parameters.Clear();
                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);

                Int64 iID = 0;

                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    iID = Int64.Parse(dr[0].ToString());
                }

                TransferOut clsTransferOut = new TransferOut(base.Connection, base.Transaction);
                clsTransferOut.SynchronizeAmount(Details.TransferOutID);

                return iID;
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Beispiel #16
0
        private void Import()
        {
            if (txtPath.HasFile)
            {
                string fn = System.IO.Path.GetFileName(txtPath.PostedFile.FileName);

                if (fn.Contains("_" + Constants.PURCHASE_ORDER_CODE) == false)
                {
                    string stScript = "<Script>";
                    stScript += "window.alert('Please select a VALID Transfer In file to upload.')";
                    stScript += "</Script>";
                    Response.Write(stScript);
                    return;
                }

                string SaveLocation = "/RetailPlus/temp/uploaded_" + fn;

                txtPath.PostedFile.SaveAs(SaveLocation);
                XmlTextReader xmlReader = new XmlTextReader(SaveLocation);
                xmlReader.WhitespaceHandling = WhitespaceHandling.None;

                TransferOut clsTransferOut = new TransferOut();
                clsTransferOut.GetConnection();
                TransferOutDetails clsTransferOutDetails = new TransferOutDetails();

                TransferOutItem clsTransferOutItem = new TransferOutItem(clsTransferOut.Connection, clsTransferOut.Transaction);
                TransferOutItemDetails clsTransferOutItemDetails;

                Contacts clsContact = new Contacts(clsTransferOut.Connection, clsTransferOut.Transaction);
                ContactDetails clsContactDetails;

                ContactGroups clsContactGroup = new ContactGroups(clsTransferOut.Connection, clsTransferOut.Transaction);
                ContactGroupDetails clsContactGroupDetails;

                Data.Unit clsUnit = new Data.Unit(clsTransferOut.Connection, clsTransferOut.Transaction);
                UnitDetails clsUnitDetails;

                ProductGroup clsProductGroup = new Data.ProductGroup(clsTransferOut.Connection, clsTransferOut.Transaction);
                ProductGroupDetails clsProductGroupDetails;

                ProductSubGroup clsProductSubGroup = new Data.ProductSubGroup(clsTransferOut.Connection, clsTransferOut.Transaction);
                ProductSubGroupDetails clsProductSubGroupDetails;

                Products clsProduct = new Products(clsTransferOut.Connection, clsTransferOut.Transaction);
                ProductDetails clsProductDetails;

                ProductVariations clsProductVariation = new ProductVariations(clsTransferOut.Connection, clsTransferOut.Transaction);
                ProductVariationDetails clsProductVariationDetails;

                Branch clsBranch = new Branch(clsTransferOut.Connection, clsTransferOut.Transaction);
                BranchDetails clsBranchDetails;

                long lngProductID = 0; long lngProductCtr = 0;

                while (xmlReader.Read())
                {
                    switch (xmlReader.NodeType)
                    {
                        case XmlNodeType.Element:

                            if (xmlReader.Name == "TransferOutDetails")
                            {
                                clsTransferOutDetails.TransferOutNo = lnkTransferOutNo.Text;
                                clsTransferOutDetails.TransferOutDate = DateTime.Parse(lblTransferOutDate.Text);

                                clsTransferOutDetails.SupplierCode = xmlReader.GetAttribute("SupplierCode").ToString();
                                clsTransferOutDetails.SupplierContact = xmlReader.GetAttribute("SupplierContact").ToString();
                                clsTransferOutDetails.SupplierAddress = xmlReader.GetAttribute("SupplierAddress").ToString();
                                clsTransferOutDetails.SupplierTelephoneNo = xmlReader.GetAttribute("SupplierTelephoneNo").ToString();
                                clsTransferOutDetails.SupplierModeOfTerms = int.Parse(xmlReader.GetAttribute("SupplierModeOfTerms").ToString());
                                clsTransferOutDetails.SupplierTerms = int.Parse(xmlReader.GetAttribute("SupplierTerms").ToString());
                                clsTransferOutDetails.SupplierID = clsContact.Details(xmlReader.GetAttribute("SupplierCode").ToString()).ContactID;
                                if (clsTransferOutDetails.SupplierID == 0)
                                {
                                    clsContactDetails = new ContactDetails();
                                    clsContactDetails.ContactCode = clsTransferOutDetails.SupplierCode;
                                    clsContactDetails.ContactName = xmlReader.GetAttribute("SupplierName").ToString();
                                    clsContactDetails.BusinessName = clsTransferOutDetails.SupplierContact;
                                    clsContactDetails.Address = clsTransferOutDetails.SupplierAddress;
                                    clsContactDetails.TelephoneNo = clsTransferOutDetails.SupplierTelephoneNo;
                                    clsContactDetails.ModeOfTerms = (ModeOfTerms)Enum.Parse(typeof(ModeOfTerms), clsTransferOutDetails.SupplierModeOfTerms.ToString());
                                    clsContactDetails.Terms = clsTransferOutDetails.SupplierTerms;
                                    clsContactDetails.Remarks = "Added in from Imported TransferOut #";
                                    clsContactDetails.ContactGroupID = int.Parse(Contacts.DEFAULT_SUPPLIER_ID.ToString("d"));
                                    clsContactDetails.DateCreated = DateTime.Now;
                                    clsTransferOutDetails.SupplierID = clsContact.Insert(clsContactDetails);
                                }
                                clsTransferOutDetails.RequiredDeliveryDate = DateTime.Parse(xmlReader.GetAttribute("RequiredDeliveryDate").ToString());
                                clsTransferOutDetails.BranchID = clsBranch.Details(xmlReader.GetAttribute("BranchCode")).BranchID;
                                if (clsTransferOutDetails.BranchID == 0)
                                {
                                    clsBranchDetails = new BranchDetails();
                                    clsBranchDetails.BranchCode = xmlReader.GetAttribute("BranchCode");
                                    clsBranchDetails.BranchName = xmlReader.GetAttribute("BranchName");
                                    clsBranchDetails.Address = xmlReader.GetAttribute("BranchAddress");
                                    clsBranchDetails.DBIP = xmlReader.GetAttribute("BranchDBIP");
                                    clsBranchDetails.DBPort = xmlReader.GetAttribute("BranchDBPort");
                                    clsBranchDetails.Remarks = xmlReader.GetAttribute("BranchRemarks");
                                    clsTransferOutDetails.BranchID = clsBranch.Insert(clsBranchDetails);
                                }

                                clsTransferOutDetails.TransferrerID = long.Parse(xmlReader.GetAttribute("TransferrerID"));
                                clsTransferOutDetails.TransferrerName = xmlReader.GetAttribute("TransferrerName");

                                clsTransferOutDetails.SubTotal = decimal.Parse(xmlReader.GetAttribute("SubTotal"));
                                clsTransferOutDetails.Discount = decimal.Parse(xmlReader.GetAttribute("Discount"));
                                clsTransferOutDetails.DiscountApplied = decimal.Parse(xmlReader.GetAttribute("DiscountApplied"));
                                clsTransferOutDetails.DiscountType = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), xmlReader.GetAttribute("DiscountType"));
                                clsTransferOutDetails.VAT = decimal.Parse(xmlReader.GetAttribute("VAT"));
                                clsTransferOutDetails.VatableAmount = decimal.Parse(xmlReader.GetAttribute("VatableAmount"));
                                clsTransferOutDetails.EVAT = decimal.Parse(xmlReader.GetAttribute("EVAT"));
                                clsTransferOutDetails.EVatableAmount = decimal.Parse(xmlReader.GetAttribute("EVatableAmount"));
                                clsTransferOutDetails.LocalTax = decimal.Parse(xmlReader.GetAttribute("LocalTax"));
                                clsTransferOutDetails.Freight = decimal.Parse(xmlReader.GetAttribute("Freight"));
                                clsTransferOutDetails.Deposit = decimal.Parse(xmlReader.GetAttribute("Deposit"));
                                clsTransferOutDetails.UnpaidAmount = decimal.Parse(xmlReader.GetAttribute("UnpaidAmount"));
                                clsTransferOutDetails.PaidAmount = decimal.Parse(xmlReader.GetAttribute("PaidAmount"));
                                clsTransferOutDetails.TotalItemDiscount = decimal.Parse(xmlReader.GetAttribute("TotalItemDiscount"));
                                clsTransferOutDetails.Status = (TransferOutStatus)Enum.Parse(typeof(TransferOutStatus), xmlReader.GetAttribute("Status"));
                                clsTransferOutDetails.Remarks = xmlReader.GetAttribute("Remarks");
                                clsTransferOutDetails.SupplierDRNo = xmlReader.GetAttribute("SupplierDRNo");
                                clsTransferOutDetails.DeliveryDate = DateTime.Parse(xmlReader.GetAttribute("DeliveryDate"));
                                clsTransferOutDetails.CancelledDate = DateTime.Parse(xmlReader.GetAttribute("CancelledDate"));
                                clsTransferOutDetails.Remarks = xmlReader.GetAttribute("Remarks");
                                clsTransferOutDetails.CancelledRemarks = xmlReader.GetAttribute("CancelledRemarks");
                                clsTransferOutDetails.CancelledByID = long.Parse(xmlReader.GetAttribute("CancelledByID"));

                                clsTransferOut.Update(clsTransferOutDetails);

                            }
                            else if (xmlReader.Name == "TransferOutItem")
                            {
                                clsTransferOutItemDetails = new TransferOutItemDetails();
                                clsTransferOutItemDetails.TransferOutID = long.Parse(lblTransferOutID.Text);

                                clsTransferOutItemDetails.ProductCode = xmlReader.GetAttribute("ProductCode");
                                clsTransferOutItemDetails.BarCode = xmlReader.GetAttribute("BarCode");
                                clsTransferOutItemDetails.Description = xmlReader.GetAttribute("ProductDesc");
                                clsTransferOutItemDetails.ProductSubGroup = xmlReader.GetAttribute("ItemProductSubGroup");
                                clsTransferOutItemDetails.ProductGroup = xmlReader.GetAttribute("ItemProductGroup");
                                clsTransferOutItemDetails.ProductUnitID = Convert.ToInt32(xmlReader.GetAttribute("ItemProductUnitID"));
                                clsTransferOutItemDetails.ProductUnitCode = xmlReader.GetAttribute("ItemProductUnitCode");
                                clsTransferOutItemDetails.Quantity = Convert.ToDecimal(xmlReader.GetAttribute("ItemQuantity"));
                                clsTransferOutItemDetails.UnitCost = Convert.ToDecimal(xmlReader.GetAttribute("ItemUnitCost"));
                                clsTransferOutItemDetails.Discount = Convert.ToDecimal(xmlReader.GetAttribute("ItemDiscount"));
                                clsTransferOutItemDetails.DiscountApplied = Convert.ToDecimal(xmlReader.GetAttribute("ItemDiscountApplied"));
                                clsTransferOutItemDetails.DiscountType = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), xmlReader.GetAttribute("ItemDiscountType"));
                                clsTransferOutItemDetails.Amount = Convert.ToDecimal(xmlReader.GetAttribute("ItemAmount"));
                                clsTransferOutItemDetails.IsVatable = Convert.ToBoolean(Convert.ToInt16(xmlReader.GetAttribute("ItemIsVatable")));
                                clsTransferOutItemDetails.VatableAmount = Convert.ToDecimal(xmlReader.GetAttribute("ItemVatableAmount"));
                                clsTransferOutItemDetails.EVatableAmount = Convert.ToDecimal(xmlReader.GetAttribute("ItemEVatableAmount"));
                                clsTransferOutItemDetails.LocalTax = Convert.ToDecimal(xmlReader.GetAttribute("ItemLocalTax"));
                                clsTransferOutItemDetails.VAT = Convert.ToDecimal(xmlReader.GetAttribute("ItemVAT"));
                                clsTransferOutItemDetails.EVAT = Convert.ToDecimal(xmlReader.GetAttribute("ItemEVAT"));
                                clsTransferOutItemDetails.LocalTax = Convert.ToDecimal(xmlReader.GetAttribute("ItemLocalTax"));
                                clsTransferOutItemDetails.isVATInclusive = Convert.ToBoolean(Convert.ToInt16(xmlReader.GetAttribute("ItemisVATInclusive")));
                                clsTransferOutItemDetails.IsVatable = Convert.ToBoolean(Convert.ToInt16(xmlReader.GetAttribute("ItemIsVatable")));
                                clsTransferOutItemDetails.TransferOutItemStatus = (TransferOutItemStatus)Enum.Parse(typeof(TransferOutItemStatus), xmlReader.GetAttribute("ItemTransferOutItemStatus"));
                                clsTransferOutItemDetails.VariationMatrixID = Convert.ToInt64(xmlReader.GetAttribute("ItemVariationMatrixID"));
                                clsTransferOutItemDetails.MatrixDescription = xmlReader.GetAttribute("ItemBaseVariationDescription");
                                clsTransferOutItemDetails.ProductGroup = xmlReader.GetAttribute("ProductGroup");
                                clsTransferOutItemDetails.ProductSubGroup = xmlReader.GetAttribute("ProductSubGroup");
                                clsTransferOutItemDetails.Remarks = xmlReader.GetAttribute("ItemRemarks");
                                clsTransferOutItemDetails.SellingPrice = Convert.ToDecimal(xmlReader.GetAttribute("ItemSellingPrice"));
                                clsTransferOutItemDetails.SellingVAT = Convert.ToDecimal(xmlReader.GetAttribute("ItemSellingVAT"));
                                clsTransferOutItemDetails.SellingEVAT = Convert.ToDecimal(xmlReader.GetAttribute("ItemSellingEVAT"));
                                clsTransferOutItemDetails.SellingLocalTax = Convert.ToDecimal(xmlReader.GetAttribute("ItemSellingLocalTax"));
                                clsTransferOutItemDetails.OldSellingPrice = Convert.ToDecimal(xmlReader.GetAttribute("ItemOldSellingPrice"));

                                clsTransferOutItemDetails.ProductID = clsProduct.Details(clsTransferOutItemDetails.BarCode).ProductID;
                                lngProductID = clsTransferOutItemDetails.ProductID;
                                if (clsTransferOutItemDetails.ProductID == 0)
                                {
                                    clsTransferOutItemDetails.ProductID = clsProduct.Details(clsTransferOutItemDetails.ProductCode).ProductID;
                                    if (clsTransferOutItemDetails.ProductID == 0)
                                    {
                                        //insert new product
                                        clsProductDetails = new ProductDetails();
                                        clsProductDetails.BarCode = clsTransferOutItemDetails.BarCode;
                                        clsProductDetails.ProductCode = clsTransferOutItemDetails.ProductCode;
                                        clsProductDetails.ProductDesc = clsTransferOutItemDetails.Description;
                                        clsProductDetails.ProductGroupCode = xmlReader.GetAttribute("ProductGroupCode");
                                        clsProductDetails.ProductGroupName = xmlReader.GetAttribute("ProductGroupName");
                                        clsProductDetails.ProductSubGroupCode = xmlReader.GetAttribute("ProductSubGroupCode");
                                        clsProductDetails.ProductSubGroupName = xmlReader.GetAttribute("ProductSubGroupName");
                                        clsProductDetails.BaseUnitCode = xmlReader.GetAttribute("BaseUnitCode");
                                        clsProductDetails.BaseUnitName = xmlReader.GetAttribute("BaseUnitName");
                                        clsProductDetails.DateCreated = DateTime.Now;
                                        clsProductDetails.Price = Convert.ToDecimal(xmlReader.GetAttribute("Price"));
                                        clsProductDetails.PurchasePrice = Convert.ToDecimal(xmlReader.GetAttribute("PurchasePrice"));
                                        clsProductDetails.IncludeInSubtotalDiscount = Convert.ToBoolean(xmlReader.GetAttribute("IncludeInSubtotalDiscount"));
                                        clsProductDetails.VAT = Convert.ToDecimal(xmlReader.GetAttribute("VAT"));
                                        clsProductDetails.EVAT = Convert.ToDecimal(xmlReader.GetAttribute("EVAT"));
                                        clsProductDetails.LocalTax = Convert.ToDecimal(xmlReader.GetAttribute("LocalTax"));
                                        clsProductDetails.Quantity = 0;
                                        clsProductDetails.MinThreshold = Convert.ToDecimal(xmlReader.GetAttribute("MinThreshold"));
                                        clsProductDetails.MaxThreshold = Convert.ToDecimal(xmlReader.GetAttribute("MaxThreshold"));
                                        clsProductDetails.ChartOfAccountIDPurchase = int.Parse(xmlReader.GetAttribute("ChartOfAccountIDPurchase"));
                                        clsProductDetails.ChartOfAccountIDSold = int.Parse(xmlReader.GetAttribute("ChartOfAccountIDSold"));
                                        clsProductDetails.ChartOfAccountIDInventory = int.Parse(xmlReader.GetAttribute("ChartOfAccountIDInventory"));
                                        clsProductDetails.ChartOfAccountIDTaxPurchase = int.Parse(xmlReader.GetAttribute("ChartOfAccountIDTaxPurchase"));
                                        clsProductDetails.ChartOfAccountIDTaxSold = int.Parse(xmlReader.GetAttribute("ChartOfAccountIDTaxSold"));
                                        clsProductDetails.IsItemSold = Convert.ToBoolean(xmlReader.GetAttribute("IsItemSold"));
                                        clsProductDetails.WillPrintProductComposition = Convert.ToBoolean(xmlReader.GetAttribute("WillPrintProductComposition"));
                                        clsProductDetails.UpdatedBy = long.Parse(xmlReader.GetAttribute("UpdatedBy"));
                                        clsProductDetails.UpdatedOn = Convert.ToDateTime(xmlReader.GetAttribute("UpdatedOn"));
                                        clsProductDetails.PercentageCommision = decimal.Parse(xmlReader.GetAttribute("PercentageCommision"));
                                        clsProductDetails.QuantityIN = clsProductDetails.Quantity;
                                        clsProductDetails.QuantityOUT = 0;

                                        clsProductDetails.SupplierCode = clsTransferOutDetails.SupplierCode;
                                        clsProductDetails.SupplierID = clsContact.Details(clsProductDetails.SupplierCode).ContactID;
                                        if (clsProductDetails.SupplierID == 0)
                                        {
                                            clsContactDetails = new ContactDetails();
                                            clsContactDetails.ContactGroupID = clsContactGroup.Details(int.Parse(ContactGroupCategory.SUPPLIER.ToString("d"))).ContactGroupID;
                                            if (clsContactDetails.ContactGroupID == 0)
                                            {
                                                clsContactGroupDetails = new ContactGroupDetails();
                                                clsContactGroupDetails.ContactGroupCode = xmlReader.GetAttribute("SUP");
                                                clsContactGroupDetails.ContactGroupName = xmlReader.GetAttribute("Default Supplier Group");
                                                clsContactGroupDetails.ContactGroupCategory = ContactGroupCategory.SUPPLIER;
                                                clsContactDetails.ContactGroupID = clsContactGroup.Insert(clsContactGroupDetails);
                                            }

                                            clsContactDetails.ContactCode = clsTransferOutDetails.SupplierCode;
                                            clsContactDetails.ContactName = clsTransferOutDetails.SupplierContact;

                                            clsContactDetails.ModeOfTerms = (ModeOfTerms)Enum.Parse(typeof(ModeOfTerms), clsTransferOutDetails.SupplierModeOfTerms.ToString());
                                            clsContactDetails.Terms = clsTransferOutDetails.SupplierTerms;
                                            clsContactDetails.Address = clsTransferOutDetails.SupplierAddress;
                                            clsContactDetails.BusinessName = clsTransferOutDetails.SupplierContact;
                                            clsContactDetails.TelephoneNo = clsTransferOutDetails.SupplierTelephoneNo;
                                            clsContactDetails.Remarks = "Added in XML import";
                                            clsContactDetails.Debit = 0;
                                            clsContactDetails.Credit = 0;
                                            clsContactDetails.IsCreditAllowed = false;
                                            clsContactDetails.CreditLimit = 0;
                                            clsProductDetails.SupplierID = clsContact.Insert(clsContactDetails);
                                        }

                                        clsProductDetails.BaseUnitID = clsUnit.Details(clsProductDetails.BaseUnitCode).UnitID;
                                        if (clsProductDetails.BaseUnitID == 0)
                                        {
                                            clsUnitDetails = new UnitDetails();
                                            clsUnitDetails.UnitCode = clsProductDetails.BaseUnitCode;
                                            clsUnitDetails.UnitName = clsProductDetails.BaseUnitName;
                                            clsProductDetails.BaseUnitID = clsUnit.Insert(clsUnitDetails);
                                        }

                                        clsProductDetails.ProductGroupID = clsProductGroup.Details(clsProductDetails.ProductGroupCode).ProductGroupID;
                                        if (clsProductDetails.ProductGroupID == 0)
                                        {
                                            clsProductGroupDetails = new ProductGroupDetails();
                                            clsProductGroupDetails.ProductGroupCode = clsProductDetails.ProductGroupCode;
                                            clsProductGroupDetails.ProductGroupName = clsProductDetails.ProductGroupName;
                                            clsProductGroupDetails.UnitDetails = new UnitDetails
                                            {
                                                UnitID = clsProductDetails.BaseUnitID
                                            };
                                            clsProductGroupDetails.Price = clsProductDetails.Price;
                                            clsProductGroupDetails.PurchasePrice = clsProductDetails.PurchasePrice;
                                            clsProductGroupDetails.IncludeInSubtotalDiscount = clsProductDetails.IncludeInSubtotalDiscount;
                                            clsProductGroupDetails.VAT = clsProductDetails.VAT;
                                            clsProductGroupDetails.EVAT = clsProductDetails.EVAT;
                                            clsProductGroupDetails.LocalTax = clsProductDetails.LocalTax;
                                            clsProductDetails.ProductGroupID = clsProductGroup.Insert(clsProductGroupDetails);
                                        }

                                        clsProductDetails.ProductSubGroupID = clsProductSubGroup.Details(clsProductDetails.ProductSubGroupCode).ProductSubGroupID;
                                        if (clsProductDetails.ProductSubGroupID == 0)
                                        {
                                            clsProductSubGroupDetails = new ProductSubGroupDetails();
                                            clsProductSubGroupDetails.ProductGroupID = clsProductDetails.ProductGroupID;
                                            clsProductSubGroupDetails.ProductSubGroupCode = clsProductDetails.ProductSubGroupCode;
                                            clsProductSubGroupDetails.ProductSubGroupName = clsProductDetails.ProductSubGroupName;
                                            clsProductSubGroupDetails.BaseUnitID = clsProductDetails.BaseUnitID;
                                            clsProductSubGroupDetails.Price = clsProductDetails.Price;
                                            clsProductSubGroupDetails.PurchasePrice = clsProductDetails.PurchasePrice;
                                            clsProductSubGroupDetails.IncludeInSubtotalDiscount = clsProductDetails.IncludeInSubtotalDiscount;
                                            clsProductSubGroupDetails.VAT = clsProductDetails.VAT;
                                            clsProductSubGroupDetails.EVAT = clsProductDetails.EVAT;
                                            clsProductSubGroupDetails.LocalTax = clsProductDetails.LocalTax;
                                            clsProductDetails.ProductSubGroupID = clsProductSubGroup.Insert(clsProductSubGroupDetails);
                                        }

                                        clsTransferOutItemDetails.ProductID = clsProduct.Insert(clsProductDetails);
                                    }
                                    else
                                    {
                                        //product code already exist but not the same barcode
                                        clsProduct.UpdateBarcode(clsTransferOutItemDetails.ProductID, clsTransferOutItemDetails.BarCode);
                                    }
                                    lngProductID = clsTransferOutItemDetails.ProductID;
                                }

                                clsTransferOutItem.Insert(clsTransferOutItemDetails);

                                clsTransferOutDetails = new TransferOutDetails();
                                clsTransferOutDetails.TransferOutID = clsTransferOutItemDetails.TransferOutID;
                                clsTransferOutDetails.DiscountApplied = Convert.ToDecimal(txtTransferOutDiscountApplied.Text);
                                clsTransferOutDetails.DiscountType = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), cboTransferOutDiscountType.SelectedItem.Value);

                                clsTransferOutDetails.Discount2Applied = Convert.ToDecimal(txtTransferOutDiscount2Applied.Text);
                                clsTransferOutDetails.Discount2Type = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), cboTransferOutDiscount2Type.SelectedItem.Value);

                                clsTransferOutDetails.Discount3Applied = Convert.ToDecimal(txtTransferOutDiscount2Applied.Text);
                                clsTransferOutDetails.Discount3Type = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), cboTransferOutDiscount3Type.SelectedItem.Value);

                                clsTransferOut = new TransferOut(clsTransferOutItem.Connection, clsTransferOutItem.Transaction);
                                clsTransferOut.UpdateDiscount(clsTransferOutItemDetails.TransferOutID, clsTransferOutDetails.DiscountApplied, clsTransferOutDetails.DiscountType, clsTransferOutDetails.Discount2Applied, clsTransferOutDetails.Discount2Type, clsTransferOutDetails.Discount3Applied, clsTransferOutDetails.Discount3Type);

                                clsTransferOutDetails = clsTransferOut.Details(clsTransferOutItemDetails.TransferOutID);
                                UpdateFooter(clsTransferOutDetails);

                                lngProductCtr++;
                            }
                            else if (xmlReader.Name == "Variation")
                            {
                                if (lngProductID != 0)
                                {
                                    clsProductVariationDetails = new ProductVariationDetails();

                                    clsProductVariationDetails.VariationID = clsProductVariation.Details(lngProductID, xmlReader.GetAttribute("VariationCode")).VariationID;
                                    if (clsProductVariationDetails.VariationID == 0)
                                    {
                                        clsProductVariationDetails.ProductID = lngProductID;
                                        clsProductVariationDetails.VariationCode = xmlReader.GetAttribute("VariationCode");
                                        clsProductVariationDetails.VariationType = xmlReader.GetAttribute("VariationType");

                                        clsProductVariation.Insert(clsProductVariationDetails);
                                    }
                                }
                            }
                            else
                            {
                                //lblError.Text += "<b>" + xmlReader.Name + ":</b>" + xmlReader.Value + "<br />";
                            }
                            break;
                        case XmlNodeType.Text:
                            //lblError.Text += "<b>" + xmlReader.LocalName + ":</b>" + xmlReader.Value + "<br />";
                            break;
                    }
                }
                xmlReader.Close();

                clsTransferOut.CommitAndDispose();
                LoadRecord();
                LoadItems();
            }
            else
            {
                string stScript = "<Script>";
                stScript += "window.alert('Please select Transfer In file to upload.')";
                stScript += "</Script>";
                Response.Write(stScript);
            }
        }
Beispiel #17
0
		private void SetDataSource(ReportDocument Report)
		{
            long iID = 0;
            try
            {
                if (Request.QueryString["task"].ToString().ToLower() == "reportfromposted" && Request.QueryString["transferoutid"].ToString() != null)
                { iID = Convert.ToInt64(Request.QueryString["transferoutid"].ToString()); }
                else
                { iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["transferoutid"].ToString(), Session.SessionID)); }
            }
            catch { iID = Convert.ToInt64(Common.Decrypt(lblReferrer.Text.Substring(lblReferrer.Text.IndexOf("transferoutid") + 14), Session.SessionID)); }

			ReportDataset rptds = new ReportDataset();

			TransferOut clsTransferOut = new TransferOut();
			MySqlDataReader myreader = clsTransferOut.List(iID, "TransferOutID", SortOption.Ascending);
            
			while(myreader.Read())
			{
				DataRow drNew = rptds.TransferOut.NewRow();
				
				foreach (DataColumn dc in rptds.TransferOut.Columns)
					drNew[dc] = "" + myreader[dc.ColumnName]; 
				
				rptds.TransferOut.Rows.Add(drNew);
			}
            myreader.Close();

            TransferOutItem clsTransferOutItem = new TransferOutItem(clsTransferOut.Connection, clsTransferOut.Transaction);
            MySqlDataReader myreaderitems = clsTransferOutItem.List(iID, "TransferOutItemID", SortOption.Ascending);
			while(myreaderitems.Read())
			{
				DataRow drNew = rptds.TransferOutItems.NewRow();
				
				foreach (DataColumn dc in rptds.TransferOutItems.Columns)
					drNew[dc] = "" + myreaderitems[dc.ColumnName]; 
				
				rptds.TransferOutItems.Rows.Add(drNew);
			}
            myreaderitems.Close();
            clsTransferOut.CommitAndDispose();

			Report.SetDataSource(rptds); 
			SetParameters(Report);
		}
Beispiel #18
0
		private Int64 SaveRecord()
		{
			TransferOut clsTransferOut = new TransferOut();
			clsTransferOut.GetConnection();
			lblTransferOutNo.Text = Constants.TRANSFER_OUT_CODE + CompanyDetails.BECompanyCode + DateTime.Now.Year.ToString() + clsTransferOut.LastTransactionNo();

			TransferOutDetails clsDetails = new TransferOutDetails();

			clsDetails.TransferOutNo = lblTransferOutNo.Text;
			clsDetails.TransferOutDate = Convert.ToDateTime(lblTransferOutDate.Text);
			clsDetails.SupplierID = Convert.ToInt64(cboSupplier.SelectedItem.Value);
			clsDetails.SupplierCode = cboSupplier.SelectedItem.Text;
			clsDetails.SupplierContact = txtSupplierContact.Text;
			clsDetails.SupplierAddress = txtSupplierAddress.Text;
			clsDetails.SupplierTelephoneNo = txtSupplierTelephoneNo.Text;
            clsDetails.SupplierTerms = Convert.ToInt32(lblTerms.Text);
			switch (lblModeOfterms.Text)
			{
				case "Days":
					clsDetails.SupplierModeOfTerms = 0;
					break;
				case "Months":
					clsDetails.SupplierModeOfTerms = 1;
					break;
				case "Years":
					clsDetails.SupplierModeOfTerms = 2;
					break;
			}
			clsDetails.RequiredDeliveryDate = Convert.ToDateTime(txtRequiredDeliveryDate.Text);
			clsDetails.BranchID = Convert.ToInt16(cboBranch.SelectedItem.Value);
			clsDetails.TransferrerID = Convert.ToInt64(Session["UID"].ToString());
            clsDetails.TransferrerName = Session["Name"].ToString();
			clsDetails.Status = TransferOutStatus.Open;
			clsDetails.Remarks = txtRemarks.Text;
			
			Int64 id = clsTransferOut.Insert(clsDetails);
			clsTransferOut.CommitAndDispose();

			return id;
		}