コード例 #1
0
ファイル: _Details.ascx.cs プロジェクト: marioricci/erp-luma
		private void LoadRecord()
		{
			Common Common = new Common();
			Int64 iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["retid"],Session.SessionID));
			POReturns clsPOReturns = new POReturns();
			POReturnDetails clsDetails = clsPOReturns.Details(iID);
			clsPOReturns.CommitAndDispose();

			lblDebitMemoID.Text = clsDetails.DebitMemoID.ToString();
			lblReturnNo.Text = clsDetails.MemoNo;
			lblReturnDate.Text = clsDetails.MemoDate.ToString("yyyy-MM-dd HH:mm:ss");
			lblRequiredReturnDate.Text = clsDetails.RequiredPostingDate.ToString("yyyy-MM-dd");
			lblSupplierID.Text = clsDetails.SupplierID.ToString();

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

			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;
			lblReturnRemarks.Text = clsDetails.Remarks;

            UpdateFooter(clsDetails);
		}
コード例 #2
0
ファイル: _Post.ascx.cs プロジェクト: marioricci/erp-luma
		private void SaveRecord()
		{
			POReturnItemDetails clsDetails = new POReturnItemDetails();

			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.DebitMemoID = Convert.ToInt64(lblDebitMemoID.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)
            {
                if (chkInPercent.Checked == true)
                    clsDetails.DiscountType = DiscountTypes.Percentage;
                else
                    clsDetails.DiscountType = DiscountTypes.FixedValue;
            }
            else
            {
                clsDetails.DiscountType = DiscountTypes.NotApplicable;
            }

            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);
            }
            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;

			POReturnItems clsPOReturnItems = new POReturnItems();
            if (lblPODebitMemoItemID.Text != "0")
			{
                clsDetails.DebitMemoItemID = Convert.ToInt64(lblPODebitMemoItemID.Text);
				clsPOReturnItems.Update(clsDetails);
			}
			else
				clsPOReturnItems.Insert(clsDetails);

            POReturnDetails clsPOReturnDetails = new POReturnDetails();
            clsPOReturnDetails.DebitMemoID = clsDetails.DebitMemoID;
            clsPOReturnDetails.DiscountApplied = Convert.ToDecimal(txtPODebitMemoDiscountApplied.Text);
            clsPOReturnDetails.DiscountType = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), cboPODebitMemoDiscountType.SelectedItem.Value);

            clsPOReturnDetails.Discount2Applied = Convert.ToDecimal(txtPODebitMemoDiscount2Applied.Text);
            clsPOReturnDetails.Discount2Type = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), cboPODebitMemoDiscount2Type.SelectedItem.Value);

            clsPOReturnDetails.Discount3Applied = Convert.ToDecimal(txtPODebitMemoDiscount3Applied.Text);
            clsPOReturnDetails.Discount3Type = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), cboPODebitMemoDiscount3Type.SelectedItem.Value);

            POReturns clsPOReturns = new POReturns(clsPOReturnItems.Connection, clsPOReturnItems.Transaction);
            clsPOReturns.UpdateDiscount(clsDetails.DebitMemoID, clsPOReturnDetails.DiscountApplied, clsPOReturnDetails.DiscountType, clsPOReturnDetails.Discount2Applied, clsPOReturnDetails.Discount2Type, clsPOReturnDetails.Discount3Applied, clsPOReturnDetails.Discount3Type);

			clsPOReturnDetails = clsPOReturns.Details(clsDetails.DebitMemoID);
			clsPOReturnItems.CommitAndDispose();

            UpdateFooter(clsPOReturnDetails);
		}
コード例 #3
0
ファイル: _Post.ascx.cs プロジェクト: marioricci/erp-luma
		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)
			{
				POReturnItems clsPOReturnItems = new POReturnItems();
				clsPOReturnItems.Delete( stIDs.Substring(0,stIDs.Length-1));

				POReturns clsPOReturns = new POReturns(clsPOReturnItems.Connection, clsPOReturnItems.Transaction);
				clsPOReturns.SynchronizeAmount(Convert.ToInt64(lblDebitMemoID.Text));

				POReturnDetails clsPOReturnDetails = clsPOReturns.Details(Convert.ToInt64(lblDebitMemoID.Text));
				clsPOReturnItems.CommitAndDispose();

                UpdateFooter(clsPOReturnDetails);
			}

			return boRetValue;
		}
コード例 #4
0
ファイル: _Post.ascx.cs プロジェクト: marioricci/erp-luma
		private void LoadRecord()
		{
			Common Common = new Common();
			Int64 iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["retid"],Session.SessionID));
			POReturns clsPOReturns = new POReturns();
			POReturnDetails clsDetails = clsPOReturns.Details(iID);
			clsPOReturns.CommitAndDispose();

			lblDebitMemoID.Text = clsDetails.DebitMemoID.ToString();
			lnkReturnNo.Text = clsDetails.MemoNo;
            lnkReturnNo.NavigateUrl = "Default.aspx?task=" + Common.Encrypt("details", Session.SessionID) + "&retid=" + Common.Encrypt(clsDetails.DebitMemoID.ToString(), Session.SessionID);
			lblReturnDate.Text = clsDetails.MemoDate.ToString("yyyy-MM-dd HH:mm:ss");
			lblRequiredReturnDate.Text = clsDetails.RequiredPostingDate.ToString("yyyy-MM-dd");
			lblSupplierID.Text = clsDetails.SupplierID.ToString();
			lnkSupplierCode.Text = clsDetails.SupplierCode.ToString();
            lnkSupplierCode.NavigateUrl = "../_Vendor/Default.aspx?task=" + Common.Encrypt("details", Session.SessionID) + "&id=" + Common.Encrypt(clsDetails.SupplierID.ToString(), Session.SessionID);	
			lnkSupplierContact.Text = clsDetails.SupplierContact;
            lnkSupplierContact.NavigateUrl = "../_Vendor/Default.aspx?task=" + Common.Encrypt("details", Session.SessionID) + "&id=" + Common.Encrypt(clsDetails.SupplierID.ToString(), Session.SessionID);	
			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;
			lblReturnRemarks.Text = clsDetails.Remarks;

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

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

            txtPODebitMemoDiscount3Applied.Text = clsDetails.Discount3Applied.ToString("###0.#0");
            cboPODebitMemoDiscount3Type.SelectedIndex = cboPODebitMemoDiscount3Type.Items.IndexOf(cboPODebitMemoDiscountType.Items.FindByValue(clsDetails.Discount3Type.ToString("d")));
            lblPODebitMemoDiscount3.Text = clsDetails.Discount3.ToString("#,##0.#0");
            lblTotalDiscount3.Text = Convert.ToDecimal(clsDetails.SubTotal + clsDetails.Discount3).ToString("#,##0.#0");

            lblPODebitMemoVatableAmount.Text = clsDetails.VatableAmount.ToString("#,##0.#0");
            txtPODebitMemoFreight.Text = clsDetails.Freight.ToString("#,##0.#0");
            txtPODebitMemoDeposit.Text = clsDetails.Deposit.ToString("#,##0.#0");
            lblPODebitMemoSubTotal.Text = Convert.ToDecimal(clsDetails.SubTotal - clsDetails.VAT).ToString("#,##0.#0");
            lblPODebitMemoVAT.Text = clsDetails.VAT.ToString("#,##0.#0");
            lblPODebitMemoTotal.Text = clsDetails.SubTotal.ToString("#,##0.#0");
		}
コード例 #5
0
ファイル: _Post.ascx.cs プロジェクト: marioricci/erp-luma
        protected void chkIsVatInclusive_CheckedChanged(object sender, EventArgs e)
        {
            try
            {
                long POReturnsID = long.Parse(lblDebitMemoID.Text);

                POReturns clsPOReturns = new POReturns();
                clsPOReturns.UpdateIsVatInclusive(POReturnsID, chkIsVatInclusive.Checked);

                POReturnDetails clsPOReturnDetails = clsPOReturns.Details(POReturnsID);
                clsPOReturns.CommitAndDispose();

                UpdateFooter(clsPOReturnDetails);
            }
            catch (Exception ex) { throw ex; }
        }
コード例 #6
0
ファイル: _Post.ascx.cs プロジェクト: marioricci/erp-luma
        private void UpdateDeposit()
        {
            POReturnDetails clsPOReturnDetails = new POReturnDetails();
            clsPOReturnDetails.DebitMemoID = Convert.ToInt64(lblDebitMemoID.Text);
            clsPOReturnDetails.Deposit = Convert.ToDecimal(txtPODebitMemoDeposit.Text);

            POReturns clsPOReturns = new POReturns();
            clsPOReturns.UpdateDeposit(clsPOReturnDetails.DebitMemoID, clsPOReturnDetails.Deposit);
            clsPOReturns.SynchronizeAmount(clsPOReturnDetails.DebitMemoID);
            clsPOReturnDetails = clsPOReturns.Details(clsPOReturnDetails.DebitMemoID);
            clsPOReturns.CommitAndDispose();

            UpdateFooter(clsPOReturnDetails);
        }
コード例 #7
0
ファイル: _Post.ascx.cs プロジェクト: marioricci/erp-luma
        private void UpdatePODiscount()
        {
            POReturnDetails clsPOReturnDetails = new POReturnDetails();
            clsPOReturnDetails.DebitMemoID = Convert.ToInt64(lblDebitMemoID.Text);
            clsPOReturnDetails.DiscountApplied = Convert.ToDecimal(txtPODebitMemoDiscountApplied.Text);
            clsPOReturnDetails.DiscountType = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), cboPODebitMemoDiscountType.SelectedItem.Value);

            clsPOReturnDetails.Discount2Applied = Convert.ToDecimal(txtPODebitMemoDiscount2Applied.Text);
            clsPOReturnDetails.Discount2Type = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), cboPODebitMemoDiscount2Type.SelectedItem.Value);

            clsPOReturnDetails.Discount3Applied = Convert.ToDecimal(txtPODebitMemoDiscount3Applied.Text);
            clsPOReturnDetails.Discount3Type = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), cboPODebitMemoDiscount3Type.SelectedItem.Value);


            POReturns clsPOReturns = new POReturns();
            clsPOReturns.UpdateDiscount(clsPOReturnDetails.DebitMemoID, clsPOReturnDetails.DiscountApplied, clsPOReturnDetails.DiscountType, clsPOReturnDetails.Discount2Applied, clsPOReturnDetails.Discount2Type, clsPOReturnDetails.Discount3Applied, clsPOReturnDetails.Discount3Type);
            clsPOReturns.SynchronizeAmount(Convert.ToInt64(lblDebitMemoID.Text));
            clsPOReturnDetails = clsPOReturns.Details(Convert.ToInt64(lblDebitMemoID.Text));
            clsPOReturns.CommitAndDispose();

            UpdateFooter(clsPOReturnDetails);
        }
コード例 #8
0
ファイル: _Update.ascx.cs プロジェクト: marioricci/erp-luma
		private void LoadRecord()
		{
			Common Common = new Common();
			Int64 iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["retid"],Session.SessionID));
			POReturns clsPOReturns = new POReturns();
			POReturnDetails clsDetails = clsPOReturns.Details(iID);
			clsPOReturns.CommitAndDispose();

			lblDebitMemoID.Text = clsDetails.DebitMemoID.ToString();
			lnkReturnNo.Text = clsDetails.MemoNo;
            lnkReturnNo.NavigateUrl = "Default.aspx?task=" + Common.Encrypt("details", Session.SessionID) + "&retid=" + Common.Encrypt(clsDetails.DebitMemoID.ToString(), Session.SessionID);

			lblReturnDate.Text = clsDetails.MemoDate.ToString("yyyy-MM-dd HH:mm:ss");
			txtRequiredReturnDate.Text = clsDetails.RequiredPostingDate.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;
		}