Пример #1
0
        private void LoadChangeDiscount()
        {
            if (cboDiscountType.Text != null & cboDiscountType.Text != "")
            {
                Data.Discount        clsDiscount        = new Data.Discount();
                Data.DiscountDetails clsDiscountDetails = clsDiscount.Details(cboDiscountType.Text);
                clsDiscount.CommitAndDispose();

                //if (clsDiscountDetails.DiscountPrice == 0)
                //{
                //    mDiscountType = DiscountTypes.NotApplicable;
                //    lblHeader.Text = "Not Applicable";
                //    lblDiscountType.Visible = false;
                //}
                //else
                lblHeader.Text = mstHeader;
                if (clsDiscountDetails.InPercent)
                {
                    mDiscountType           = DiscountTypes.Percentage;
                    lblDiscountType.Visible = true;
                }
                else
                {
                    mDiscountType           = DiscountTypes.FixedValue;
                    lblDiscountType.Visible = false;
                }

                txtAmount.Text = clsDiscountDetails.DiscountPrice.ToString("#,##0.#0");
            }
        }
Пример #2
0
        internal static DiscountItem ConvertToDiscountItem(int discountTypeInt, int manualDiscountTypeInt, int customerDiscountTypeInt, decimal effectiveAmount, decimal dealPrice, decimal discountAmount, decimal percentage, string offerId, string offerName, string discountCode)
        {
            DiscountTypes discountType  = (DiscountTypes)discountTypeInt;
            bool          isManualTotal = manualDiscountTypeInt == (int)ManualDiscountType.TotalDiscountAmount || manualDiscountTypeInt == (int)ManualDiscountType.TotalDiscountPercent;

            DiscountItem discountItem = (DiscountItem)SalesOrder.InternalApplication.BusinessLogic.Utility.CreateDiscountItem(discountType, isManualTotal);

            discountItem.EffectiveAmount = effectiveAmount;
            discountItem.DealPrice       = dealPrice;
            discountItem.Amount          = discountAmount;
            discountItem.Percentage      = percentage;

            PeriodicDiscountItem periodicDiscountItem;
            CustomerDiscountItem customerDiscountItem;
            LineDiscountItem     lineDiscountItem;

            if ((lineDiscountItem = discountItem as LineDiscountItem) != null)
            {
                lineDiscountItem.LineDiscountType = (LineDiscountItem.DiscountTypes)discountType;

                if ((periodicDiscountItem = discountItem as PeriodicDiscountItem) != null)
                {
                    periodicDiscountItem.DiscountCode = discountCode;
                    periodicDiscountItem.OfferId      = offerId;
                    periodicDiscountItem.OfferName    = offerName;
                }
                else if ((customerDiscountItem = discountItem as CustomerDiscountItem) != null)
                {
                    CustomerDiscountTypes customerDiscountType = (CustomerDiscountTypes)customerDiscountTypeInt;
                    customerDiscountItem.CustomerDiscountType = (CustomerDiscountItem.CustomerDiscountTypes)(customerDiscountType);
                }
            }

            return(discountItem);
        }
    public PriceCalculator(string command)
    {
        var splitCommand = command.Split();

        pricePerNight = decimal.Parse(splitCommand[0]);
        nights        = int.Parse(splitCommand[1]);
        season        = Enum.Parse <Seasons>(splitCommand[2]);
        discount      = DiscountTypes.None;
        if (splitCommand.Length > 3)
        {
            discount = Enum.Parse <DiscountTypes>(splitCommand[3]);
        }
    }
Пример #4
0
        public IDiscountStrategy Create(DiscountTypes discountType)
        {
            // First determine the discount strategy
            switch (discountType)
            {
            case DiscountTypes.noDiscount:
                return(this.discountStrategies[DiscountTypes.noDiscount]);

            case DiscountTypes.simpleDiscount:
                return(this.discountStrategies[DiscountTypes.simpleDiscount]);

            case DiscountTypes.groupDiscount:
                return(this.discountStrategies[DiscountTypes.groupDiscount]);

            case DiscountTypes.addonDiscount:
                return(this.discountStrategies[DiscountTypes.addonDiscount]);

            default:
                return(this.discountStrategies[DiscountTypes.noDiscount]);
            }
        }
Пример #5
0
        public void UpdateDiscount(long CreditMemoID, decimal DiscountApplied, DiscountTypes DiscountType)
        {
            try
            {
                string SQL = "UPDATE tblSOCreditMemo SET " +
                             "DiscountApplied        =   @DiscountApplied, " +
                             "DiscountType           =   @DiscountType " +
                             "WHERE CreditMemoID = @CreditMemoID;";



                MySqlCommand cmd = new MySqlCommand();


                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = SQL;

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

                MySqlParameter prmDiscountType = new MySqlParameter("@DiscountType", MySqlDbType.Int16);
                prmDiscountType.Value = Convert.ToInt16(DiscountType.ToString("d"));
                cmd.Parameters.Add(prmDiscountType);

                MySqlParameter prmCreditMemoID = new MySqlParameter("@CreditMemoID", MySqlDbType.Int64);
                prmCreditMemoID.Value = CreditMemoID;
                cmd.Parameters.Add(prmCreditMemoID);

                base.ExecuteNonQuery(cmd);
            }

            catch (Exception ex)
            {
                {
                }

                throw base.ThrowException(ex);
            }
        }
Пример #6
0
        private bool isValuesAssigned()
        {
            try
            {
                mdecDiscountAmount = Convert.ToDecimal(txtAmount.Text);
                if (mdecDiscountAmount == 0)
                {
                    mDiscountType = DiscountTypes.NotApplicable;
                }

                mDiscountCode = cboDiscountType.Text;
                mRemarks      = txtRemarks.Text;

                return(true);
            }
            catch
            {
                MessageBox.Show("Sorry you have entered an invalid amount for discount." +
                                "Please type a valid discount amount.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(false);
            }
        }
Пример #7
0
        public void DoAddDiscount()
        {
            switch (DiscountType.Id)
            {
            case 0:
                _mDiscountAmount = Convert.ToDecimal(DiscountAmount);
                break;

            case 1:
                _mDiscountAmount = (Convert.ToDecimal(DiscountAmount) / 100) * Order.TotalPrice;
                break;
            }

            Discount = new Discount {
                Amount = _mDiscountAmount, OrderId = Order.Order.Id, DiscountTypeId = DiscountType.Id, Id = 0
            };
            var discountType = DiscountTypes.Where(x => x.Id == Discount.DiscountTypeId).FirstOrDefault();

            if (Order.AddDiscount(Discount))
            {
                DiscountVisible = "Collapsed";
            }
        }
Пример #8
0
        public void UpdateDiscount(long WBranchTransferID, decimal DiscountApplied, DiscountTypes DiscountType)
        {
            try
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;

                string SQL = "UPDATE tblWBranchTransfer SET " +
                             "DiscountApplied        =   @DiscountApplied, " +
                             "DiscountType           =   @DiscountType " +
                             "WHERE WBranchTransferID = @WBranchTransferID;";

                cmd.Parameters.AddWithValue("@DiscountApplied", DiscountApplied);
                cmd.Parameters.AddWithValue("@DiscountType", DiscountType.ToString("d"));
                cmd.Parameters.AddWithValue("@WBranchTransferID", WBranchTransferID);

                cmd.CommandText = SQL;
                base.ExecuteNonQuery(cmd);
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Пример #9
0
        protected void lstItem_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                DataRowView dr = (DataRowView)e.Item.DataItem;

                HtmlInputCheckBox chkList = (HtmlInputCheckBox)e.Item.FindControl("chkList");
                chkList.Value = dr["POItemID"].ToString();

                HyperLink lnkBarcode = (HyperLink)e.Item.FindControl("lnkBarcode");
                lnkBarcode.Text = dr["Barcode"].ToString();

                HyperLink lnkDescription = (HyperLink)e.Item.FindControl("lnkDescription");
                lnkDescription.Text        = dr["Description"].ToString();
                lnkDescription.ToolTip     = dr["ProductCode"].ToString();
                lnkDescription.NavigateUrl = Constants.ROOT_DIRECTORY + "/MasterFiles/_Product/Default.aspx?task=" + Common.Encrypt("det", Session.SessionID) + "&id=" + Common.Encrypt(dr["ProductID"].ToString(), Session.SessionID);
                lnkBarcode.NavigateUrl     = Constants.ROOT_DIRECTORY + "/MasterFiles/_Product/Default.aspx?task=" + Common.Encrypt("det", Session.SessionID) + "&id=" + Common.Encrypt(dr["ProductID"].ToString(), Session.SessionID);

                HyperLink lnkMatrixDescription = (HyperLink)e.Item.FindControl("lnkMatrixDescription");
                if (dr["MatrixDescription"].ToString() != string.Empty && dr["MatrixDescription"].ToString() != null)
                {
                    lnkMatrixDescription.Visible     = true;
                    lnkMatrixDescription.Text        = dr["MatrixDescription"].ToString();
                    lnkMatrixDescription.NavigateUrl = Constants.ROOT_DIRECTORY + "/MasterFiles/_Product/_VariationsMatrix/Default.aspx?task=" + Common.Encrypt("det", Session.SessionID) + "&prodid=" + Common.Encrypt(dr["ProductID"].ToString(), Session.SessionID) + "&id=" + Common.Encrypt(dr["VariationMatrixID"].ToString(), Session.SessionID);
                }

                Label lblQuantity = (Label)e.Item.FindControl("lblQuantity");
                lblQuantity.Text = Convert.ToDecimal(dr["Quantity"].ToString()).ToString("#,##0.##0");

                Label lblProductUnitID = (Label)e.Item.FindControl("lblProductUnitID");
                lblProductUnitID.Text = dr["ProductUnitID"].ToString();

                Label lblProductUnitCode = (Label)e.Item.FindControl("lblProductUnitCode");
                lblProductUnitCode.Text = dr["ProductUnitCode"].ToString();

                Label lblUnitCost = (Label)e.Item.FindControl("lblUnitCost");
                lblUnitCost.Text = Convert.ToDecimal(dr["UnitCost"].ToString()).ToString("#,##0.##0");

                Label lblSellingPrice = (Label)e.Item.FindControl("lblSellingPrice");
                lblSellingPrice.Text = Convert.ToDecimal(dr["SellingPrice"].ToString()).ToString("#,##0.##0");

                Label lblDiscountApplied = (Label)e.Item.FindControl("lblDiscountApplied");
                lblDiscountApplied.Text = Convert.ToDecimal(dr["DiscountApplied"].ToString()).ToString("#,##0.##0");

                DiscountTypes DiscountType = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), dr["DiscountType"].ToString());
                if (DiscountType == DiscountTypes.Percentage)
                {
                    Label lblPercent = (Label)e.Item.FindControl("lblPercent");
                    lblPercent.Visible = true;
                }

                Label lblAmount = (Label)e.Item.FindControl("lblAmount");
                lblAmount.Text = Convert.ToDecimal(dr["Amount"].ToString()).ToString("#,##0.##0");

                Label lblVAT = (Label)e.Item.FindControl("lblVAT");
                lblVAT.Text = Convert.ToDecimal(dr["VAT"].ToString()).ToString("#,##0.##0");

                Label lblEVAT = (Label)e.Item.FindControl("lblEVAT");
                lblEVAT.Text = Convert.ToDecimal(dr["EVAT"].ToString()).ToString("#,##0.##0");

                Label lblisVATInclusive = (Label)e.Item.FindControl("lblisVATInclusive");
                lblisVATInclusive.Text = Convert.ToBoolean(Convert.ToInt16(dr["isVATInclusive"].ToString())).ToString();

                Label lblLocalTax = (Label)e.Item.FindControl("lblLocalTax");
                lblLocalTax.Text = Convert.ToDecimal(dr["LocalTax"].ToString()).ToString("#,##0.##0");

                Label lblRemarks = (Label)e.Item.FindControl("lblRemarks");
                lblRemarks.Text = dr["Remarks"].ToString();

                Label lblPOItemReceivedStatus = (Label)e.Item.FindControl("lblPOItemReceivedStatus");
                POItemReceivedStatus clsPOItemReceivedStatus = (POItemReceivedStatus)Enum.Parse(typeof(POItemReceivedStatus), dr["POItemReceivedStatus"].ToString());
                lblPOItemReceivedStatus.Text = clsPOItemReceivedStatus.ToString("d");

                TextBox     txtTagPriceCount        = (TextBox)e.Item.FindControl("txtTagPriceCount");
                ImageButton cmdPrintTagPriceBarCode = (ImageButton)e.Item.FindControl("cmdPrintTagPriceBarCode");
                txtTagPriceCount.Visible        = holderTagPrice.Visible;
                cmdPrintTagPriceBarCode.Visible = holderTagPrice.Visible;

                //if (holderTagPrice.Visible)
                //{
                string strUnitCode = lblProductUnitCode.Text.ToUpper();
                switch (strUnitCode)
                {
                case "CAN":
                case "BOX":
                case "PC":
                case "PCS":
                case "PIECE":
                case "BTL":
                case "BOT":
                case "BOTTLE":
                case "PACK":
                case "BNDL":

                    decimal iQty = decimal.TryParse(lblQuantity.Text, out iQty) ? iQty : 1;

                    int iQuotient, iRemainder;
                    iQuotient = Math.DivRem(Convert.ToInt32(Math.Floor(iQty)), 2, out iRemainder);

                    txtTagPriceCount.Text = (iRemainder == 1 ? (iQuotient + 1) : iQuotient).ToString("#,##0"); break;

                default:
                    txtTagPriceCount.Text = "1"; break;
                }

                //}

                //For anchor
                HtmlGenericControl divExpCollAsst = (HtmlGenericControl)e.Item.FindControl("divExpCollAsst");

                HtmlAnchor anchorDown = (HtmlAnchor)e.Item.FindControl("anchorDown");
                anchorDown.HRef = "javascript:ToggleDiv('" + divExpCollAsst.ClientID + "')";
            }
        }
Пример #10
0
 public DiscountM(double amount, DiscountTypes type)
 {
     _amount = amount;
     _type   = type;
 }
Пример #11
0
        public void PrintItem(string ItemNo, string Description, string stProductUnitCode, decimal Quantity, decimal Price, decimal Discount, decimal PromoApplied, decimal Amount, decimal VAT, decimal EVAT, string DiscountCode, DiscountTypes DiscountType)
        {
            if (!mboIsItemHeaderPrinted)
            {
                PrintReportHeadersSection(true);

                mboIsItemHeaderPrinted = true;
            }

            // description
            string stDescription = Description;
            try
            { stDescription = Description.Split(Convert.ToChar(Environment.NewLine)).GetValue(0).ToString(); }
            catch { }
            try
            { stDescription = stDescription.Substring(0, mclsTerminalDetails.MaxReceiptWidth); }
            catch { }

            // discount and promo
            string AddedString = "";
            if (Discount != 0)
            {
                if (DiscountCode.ToLower() == mclsTerminalDetails.SeniorCitizenDiscountCode.ToLower() && DiscountType == DiscountTypes.Percentage)
                    AddedString += "@" + Discount.ToString("#,##0.#0") + "%" + DiscountCode;
                else if (DiscountCode.ToLower() == mclsTerminalDetails.SeniorCitizenDiscountCode.ToLower() && DiscountType == DiscountTypes.FixedValue)
                    AddedString += "@" + Discount.ToString("#,##0.#0") + DiscountCode;
                else if (DiscountCode.ToLower() == Constants.C_DISCOUNT_CODE_FREE.ToLower() && DiscountType == DiscountTypes.Percentage)
                    AddedString += "@" + Discount.ToString("#,##0.#0") + "%" + DiscountCode;
                else if (DiscountCode.ToLower() == Constants.C_DISCOUNT_CODE_FREE.ToLower() && DiscountType == DiscountTypes.FixedValue)
                    AddedString += "@" + Discount.ToString("#,##0.#0") + DiscountCode;
                else
                    AddedString += "@" + Discount.ToString("#,##0.#0") + "disc "; 
            }
            if (PromoApplied != 0)
            { AddedString += "@" + PromoApplied.ToString("#,##0.#0") + "promo "; }

            // price
            string stPrice = Price.ToString("#,##0.#0");
            if (Price == 1 || Price == -1)
                stPrice = "1";
            else if (Decimal.Compare(Price, Decimal.Floor(Price)) == 0)
            { stPrice = Price.ToString("#,##0"); }

            // quantity
            string stQuantity = Quantity.ToString("#,##0.#0");
            if (Quantity == 1 || Quantity == -1)
                stQuantity = "1";
            else if (Decimal.Compare(Quantity, Decimal.Floor(Quantity)) == 0)
            { stQuantity = Quantity.ToString("#,##0"); }

            // evat and vat
            bool isVATable = false;
            if (VAT > 0)
            { isVATable = true; }

            string stAmount = Amount.ToString("#,##0.#0");
            //			if (Decimal.Compare(Amount, Decimal.Floor(Amount)) == 0)
            //			{	stAmount = Amount.ToString("#,##0");	}

            if (mclsSalesTransactionDetails.DiscountCode != mclsTerminalDetails.SeniorCitizenDiscountCode)
            {
                if (isVATable)
                { stAmount += "V "; }
                else
                { stAmount += "NV"; }
            }

            if (stDescription.Length <= 14 && AddedString.Length == 0)
                msbToPrint.Append(stDescription.PadRight(14));
            else
                msbToPrint.Append(stDescription.PadRight(mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);

            if (AddedString.Length <= 11 && AddedString.Length != 0)
                msbToPrint.Append(AddedString.PadRight(11));
            else if (AddedString.Length > 11)
                msbToPrint.Append(AddedString.PadRight(mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);

            if (stQuantity.Length <= 4 && stDescription.Length <= 14 && AddedString.Length == 0)
                msbToPrint.Append(stQuantity.PadLeft(3));
            else if (stQuantity.Length <= 6 && AddedString.Length == 0)
                msbToPrint.Append(stQuantity.PadLeft(17));
            else if (stQuantity.Length <= 6 && AddedString.Length > 11)
                msbToPrint.Append(stQuantity.PadLeft(17));
            else if (stQuantity.Length <= 6 && AddedString.Length != 0)
                msbToPrint.Append(stQuantity.PadLeft(6));
            else if (stQuantity.Length <= 17 && AddedString.Length == 0)
                msbToPrint.Append(stQuantity.PadLeft(17));
            else if (stQuantity.Length <= 17 && AddedString.Length != 0)
                msbToPrint.Append(stQuantity.PadLeft(17));
            else
                msbToPrint.Append(stQuantity.PadLeft(stQuantity.Length));

            if (stPrice.Length <= 10)
                msbToPrint.Append(stPrice.PadLeft(10));
            else
                msbToPrint.Append(Environment.NewLine + stPrice.PadLeft(mclsTerminalDetails.MaxReceiptWidth - 13));

            if (stAmount.Length <= 13)
                msbToPrint.Append(stAmount.PadLeft(13));
            else
                msbToPrint.Append(Environment.NewLine + stAmount.PadLeft(mclsTerminalDetails.MaxReceiptWidth));

            msbToPrint.Append(Environment.NewLine);
        }
 public static void CreateDiscount(DiscountTypes discount, int subTypes, Decimal amount, DateTime expiryDate, String voucherCode, int chargeType, int showId)
 {
     ShowDiscounts showDiscount = new ShowDiscounts();
     showDiscount.Amount = amount;
     showDiscount.DiscountType = (int)discount;
     showDiscount.Subtype = (int)subTypes;
     showDiscount.VoucherCode = voucherCode;
     showDiscount.ChargeType = chargeType;
     showDiscount.Showid = showId;
     showDiscount.Save();
 }
Пример #13
0
		private bool isValuesAssigned()
		{
			try 
			{
				mdecDiscountAmount = Convert.ToDecimal(txtAmount.Text);
				if (mdecDiscountAmount ==  0)
				{	mDiscountType = DiscountTypes.NotApplicable;	}

				mDiscountCode = cboDiscountType.Text;
				mRemarks = txtRemarks.Text;

				return true;
			}
			catch
			{
				MessageBox.Show("Sorry you have entered an invalid amount for discount." +
					"Please type a valid discount amount.","RetailPlus",MessageBoxButtons.OK, MessageBoxIcon.Warning);
				return false;
			}
		}
Пример #14
0
        public void UpdateItem(Int64 TransactionID, decimal ItemSold, decimal QuantitySold, decimal GrossSales, decimal SubTotal, decimal NetSales, decimal ItemsDiscount, decimal SNRItemsDiscount, decimal PWDItemsDiscount, decimal OtherItemsDiscount, decimal Discount, decimal SNRDiscount, decimal PWDDiscount, decimal OtherDiscount, decimal TransDiscount, DiscountTypes TransDiscountType, decimal VAT, decimal VATableAmount, decimal ZeroRatedSales, decimal NonVATableAmount, decimal VATExempt, decimal EVAT, decimal EVATableAmount, decimal NonEVATableAmount, decimal LocalTax, string DiscountCode, string DiscountRemarks, decimal Charge, decimal ChargeAmount, string ChargeCode, string ChargeRemarks, ChargeTypes ChargeType, SalesTransactionItemDetails SalesTransItemDetails)
		{
            UpdateSubTotal(TransactionID, ItemSold, QuantitySold, GrossSales, SubTotal, NetSales, ItemsDiscount, SNRItemsDiscount, PWDItemsDiscount, OtherItemsDiscount, Discount, SNRDiscount, PWDDiscount, OtherDiscount, TransDiscount, TransDiscountType, VAT, VATableAmount, ZeroRatedSales, NonVATableAmount, VATExempt, EVAT, EVATableAmount, NonEVATableAmount, LocalTax, DiscountCode, DiscountRemarks, Charge, ChargeAmount, ChargeCode, ChargeRemarks, ChargeType);

            SalesTransactionItems clsSalesTransactionItems = new SalesTransactionItems(base.Connection, base.Transaction);
			clsSalesTransactionItems.Update(SalesTransItemDetails);
		}
Пример #15
0
        public void Refund(TransactionStatus RefundTransactionStatus, Int64 TransactionID, string ORNo, decimal ItemSold, decimal QuantitySold, decimal GrossSales, decimal SubTotal, decimal NetSales, decimal ItemsDiscount, decimal SNRItemsDiscount, decimal PWDItemsDiscount, decimal OtherItemsDiscount, decimal Discount, decimal SNRDiscount, decimal PWDDiscount, decimal OtherDiscount, decimal TransDiscount, DiscountTypes TransDiscountType, decimal VAT, decimal VATableAmount, decimal ZeroRatedSales, decimal NonVATableAmount, decimal VATExempt, decimal EVAT, decimal EVATableAmount, decimal NonEVATableAmount, decimal LocalTax, decimal AmountPaid, decimal CashPayment, decimal ChequePayment, decimal CreditCardPayment, decimal CreditPayment, decimal DebitPayment, decimal RewardPointsPayment, decimal RewardConvertedPayment, decimal BalanceAmount, decimal ChangeAmount, PaymentTypes PaymentType, string DiscountCode, string DiscountRemarks, decimal Charge, decimal ChargeAmount, string ChargeCode, string ChargeRemarks, Int64 CashierID, string CashierName)
		{
			try
			{
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;

				string SQL = "UPDATE tblTransactions SET " +
                                "ORNo	            =	@ORNo, " +
								"TransactionStatus	=	@TransactionStatus, " +
                                "ItemSold		    =	@ItemSold, " +
                                "QuantitySold	    =	@QuantitySold, " +
                                "GrossSales		    =	@GrossSales, " +
                                "SubTotal			=	@SubTotal, " +
                                "NetSales			=	@NetSales, " +
								"ItemsDiscount		=	@ItemsDiscount, " +
                                "SNRItemsDiscount	=	@SNRItemsDiscount, " +
                                "PWDItemsDiscount	=	@PWDItemsDiscount, " +
                                "OtherItemsDiscount	=	@OtherItemsDiscount, " +
								"Discount			=	@Discount, " +
                                "SNRDiscount		=	@SNRDiscount, " +
                                "PWDDiscount		=	@PWDDiscount, " +
                                "OtherDiscount		=	@OtherDiscount, " +
								"TransDiscount		=	@TransDiscount, " +
								"TransDiscountType	=	@TransDiscType, " +
								"VAT				=	@VAT, " +
								"VATableAmount		=	@VATableAmount, " +
                                "ZeroRatedSales     =   @ZeroRatedSales, " +
                                "NonVATableAmount   =	@NonVATableAmount, " +
                                "VATExempt  		=	@VATExempt, " +
								"EVAT				=	@EVAT, " +
								"EVATableAmount		=	@EVATableAmount, " +
                                "NonEVATableAmount	=	@NonEVATableAmount, " +
								"LocalTax			=	@LocalTax, " +
								"AmountPaid			=	@AmountPaid, " +
								"CashPayment		=	@CashPayment, " +
								"ChequePayment		=	@ChequePayment, " +
								"CreditCardPayment	=	@CreditCardPayment, " +
								"CreditPayment		=	@CreditPayment, " +
								"DebitPayment		=	@DebitPayment, " +
								"RewardPointsPayment		=	@RewardPointsPayment, " +
								"RewardConvertedPayment		=	@RewardConvertedPayment, " +
								"BalanceAmount		=	@BalanceAmount, " +
								"ChangeAmount		=	@ChangeAmount, " +
								"DateClosed			=	NOW(), " +
								"PaymentType		=	@PaymentType, " +
								"DiscountCode		=	@DiscCode,  " +
								"DiscountRemarks	=	@DiscRemarks, " +
								"Charge				=	@Charge, " +
								"ChargeAmount		=	@ChargeAmount, " +
								"ChargeCode			=	@ChargeCode, " +
								"ChargeRemarks		=	@ChargeRemarks, " +
								"CashierID			=	@CashierID, " +
								"CashierName		=	@CashierName, " +
                                "LastModified		=	NOW() " +
							"WHERE TransactionID	=	@TransactionID;";

                cmd.Parameters.AddWithValue("ORNo", ORNo);
                cmd.Parameters.AddWithValue("TransactionStatus", RefundTransactionStatus.ToString("d"));
                cmd.Parameters.AddWithValue("ItemSold", ItemSold);
                cmd.Parameters.AddWithValue("QuantitySold", QuantitySold);
                cmd.Parameters.AddWithValue("GrossSales", GrossSales);
                cmd.Parameters.AddWithValue("SubTotal", SubTotal);
                cmd.Parameters.AddWithValue("NetSales", NetSales);
                cmd.Parameters.AddWithValue("ItemsDiscount", ItemsDiscount);
                cmd.Parameters.AddWithValue("SNRItemsDiscount", SNRItemsDiscount);
                cmd.Parameters.AddWithValue("PWDItemsDiscount", PWDItemsDiscount);
                cmd.Parameters.AddWithValue("OtherItemsDiscount", OtherItemsDiscount);
                cmd.Parameters.AddWithValue("Discount", Discount);
                cmd.Parameters.AddWithValue("SNRDiscount", SNRDiscount);
                cmd.Parameters.AddWithValue("PWDDiscount", PWDDiscount);
                cmd.Parameters.AddWithValue("OtherDiscount", OtherDiscount);
                cmd.Parameters.AddWithValue("TransDiscount", TransDiscount);
                cmd.Parameters.AddWithValue("TransDiscType", TransDiscountType.ToString("d"));
                cmd.Parameters.AddWithValue("VAT", VAT);
                cmd.Parameters.AddWithValue("VATableAmount", VATableAmount);
                cmd.Parameters.AddWithValue("ZeroRatedSales", ZeroRatedSales);
                cmd.Parameters.AddWithValue("NonVATableAmount", NonVATableAmount);
                cmd.Parameters.AddWithValue("VATExempt", VATExempt);
                cmd.Parameters.AddWithValue("EVAT", EVAT);
                cmd.Parameters.AddWithValue("EVATableAmount", EVATableAmount);
                cmd.Parameters.AddWithValue("NonEVATableAmount", NonEVATableAmount);
                cmd.Parameters.AddWithValue("LocalTax", LocalTax);
                cmd.Parameters.AddWithValue("AmountPaid", AmountPaid);
                cmd.Parameters.AddWithValue("CashPayment", CashPayment);
                cmd.Parameters.AddWithValue("ChequePayment", ChequePayment);
                cmd.Parameters.AddWithValue("CreditCardPayment", CreditCardPayment);
                cmd.Parameters.AddWithValue("CreditPayment", CreditPayment);
                cmd.Parameters.AddWithValue("DebitPayment", DebitPayment);
                cmd.Parameters.AddWithValue("RewardPointsPayment", RewardPointsPayment);
                cmd.Parameters.AddWithValue("RewardConvertedPayment", RewardConvertedPayment);
                cmd.Parameters.AddWithValue("BalanceAmount", BalanceAmount);
                cmd.Parameters.AddWithValue("ChangeAmount", ChangeAmount);
                cmd.Parameters.AddWithValue("PaymentType", PaymentType.ToString("d"));
                cmd.Parameters.AddWithValue("DiscCode", string.IsNullOrEmpty(DiscountCode) ? "" : DiscountCode);
                cmd.Parameters.AddWithValue("DiscRemarks", DiscountRemarks);
                cmd.Parameters.AddWithValue("Charge", Charge);
                cmd.Parameters.AddWithValue("ChargeAmount", ChargeAmount);
                cmd.Parameters.AddWithValue("ChargeCode", ChargeCode);
                cmd.Parameters.AddWithValue("ChargeRemarks", string.IsNullOrEmpty(ChargeRemarks) ? "" : ChargeRemarks);
                cmd.Parameters.AddWithValue("CashierID", CashierID);
                cmd.Parameters.AddWithValue("CashierName", CashierName);
                cmd.Parameters.AddWithValue("TransactionID", TransactionID);

                cmd.CommandText = SQL;
				base.ExecuteNonQuery(cmd);

				SalesTransactionItems clsSalesTransactionItems = new SalesTransactionItems(base.Connection, base.Transaction);
				clsSalesTransactionItems.RefundByTransaction(TransactionID);
			}

			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}
		}
Пример #16
0
        public void UpdateSubTotal(Int64 TransactionID, decimal ItemSold, decimal QuantitySold, decimal GrossSales, decimal SubTotal, decimal NetSales, decimal ItemsDiscount, decimal SNRItemsDiscount, decimal PWDItemsDiscount, decimal OtherItemsDiscount, decimal Discount, decimal SNRDiscount, decimal PWDDiscount, decimal OtherDiscount, decimal TransDiscount, DiscountTypes TransDiscountType, decimal VAT, decimal VATableAmount, decimal ZeroRatedSales, decimal NonVATableAmount, decimal VATExempt, decimal EVAT, decimal EVATableAmount, decimal NonEVATableAmount, decimal LocalTax, string DiscountCode, string DiscountRemarks, decimal Charge, decimal ChargeAmount, string ChargeCode, string ChargeRemarks, ChargeTypes ChargeType)
		{
            // Sep 4, 2014 : Added VATableAmount, ZeroRatedSales, NonVATableAmount, VATExempt as per requirement of BIR
            try
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;

			    string SQL = "UPDATE tblTransactions SET " +
							    "TransactionStatus	=	@TransactionStatus, " +
                                "ItemSold		    =	@ItemSold, " +
                                "QuantitySold	    =	@QuantitySold, " +
                                "GrossSales		    =	@GrossSales, " +
                                "SubTotal			=	@SubTotal, " +
                                "NetSales			=	@NetSales, " +
							    "ItemsDiscount		=	@ItemsDiscount, " +
                                "SNRItemsDiscount	=	@SNRItemsDiscount, " +
                                "PWDItemsDiscount	=	@PWDItemsDiscount, " +
                                "OtherItemsDiscount =	@OtherItemsDiscount, " +
							    "Discount			=	@Discount, " +
                                "SNRDiscount		=	@SNRDiscount, " +
                                "PWDDiscount		=	@PWDDiscount, " +
                                "OtherDiscount		=	@OtherDiscount, " +
							    "TransDiscount		=	@TransDiscount, " +
							    "TransDiscountType	=	@TransDiscType, " +
							    "VAT				=	@VAT, " +
							    "VATableAmount		=	@VATableAmount, " +
                                "ZeroRatedSales     =   @ZeroRatedSales, " +
                                "NonVATableAmount	=	@NonVATableAmount, " +
                                "VATExempt		    =	@VATExempt, " +
							    "EVAT				=	@EVAT, " +
							    "EVATableAmount		=	@EVATableAmount, " +
                                "NonEVATableAmount	=	@NonEVATableAmount, " +
							    "LocalTax			=	@LocalTax, " +
							    "DateClosed			=	NOW(), " +
							    "DiscountCode		=	@DiscCode,  " +
							    "DiscountRemarks	=	@DiscRemarks, " +
							    "Charge				=	@Charge, " +
							    "ChargeAmount		=	@ChargeAmount, " +
							    "ChargeCode			=	@ChargeCode, " +
							    "ChargeRemarks		=	@ChargeRemarks, " +
                                "ChargeType		    =	@ChargeType, " +
                                "LastModified		=	NOW() " +
						    "WHERE TransactionID	=	@TransactionID;";


                cmd.Parameters.AddWithValue("@ItemSold", ItemSold);
                cmd.Parameters.AddWithValue("@QuantitySold", QuantitySold);
                cmd.Parameters.AddWithValue("@GrossSales", GrossSales);
                cmd.Parameters.AddWithValue("@SubTotal", SubTotal);
                cmd.Parameters.AddWithValue("@NetSales", NetSales);
                cmd.Parameters.AddWithValue("@ItemsDiscount", ItemsDiscount);
                cmd.Parameters.AddWithValue("@SNRItemsDiscount", SNRItemsDiscount);
                cmd.Parameters.AddWithValue("@PWDItemsDiscount", PWDItemsDiscount);
                cmd.Parameters.AddWithValue("@OtherItemsDiscount", OtherItemsDiscount);
                cmd.Parameters.AddWithValue("@Discount", Discount);
                cmd.Parameters.AddWithValue("@SNRDiscount", SNRDiscount);
                cmd.Parameters.AddWithValue("@PWDDiscount", PWDDiscount);
                cmd.Parameters.AddWithValue("@OtherDiscount", OtherDiscount);
                cmd.Parameters.AddWithValue("@TransDiscount", TransDiscount);
                cmd.Parameters.AddWithValue("@TransDiscType", TransDiscountType.ToString("d"));
                cmd.Parameters.AddWithValue("@VAT", VAT);
                cmd.Parameters.AddWithValue("@VATableAmount", VATableAmount);
                cmd.Parameters.AddWithValue("@ZeroRatedSales", ZeroRatedSales);
                cmd.Parameters.AddWithValue("@NonVATableAmount", NonVATableAmount);
                cmd.Parameters.AddWithValue("@VATExempt", VATExempt);
                cmd.Parameters.AddWithValue("@EVAT", EVAT);
                cmd.Parameters.AddWithValue("@EVATableAmount", EVATableAmount);
                cmd.Parameters.AddWithValue("@NonEVATableAmount", NonEVATableAmount);
                cmd.Parameters.AddWithValue("@LocalTax", LocalTax);
                cmd.Parameters.AddWithValue("@TransactionStatus", TransactionStatus.SuspendedOpen.ToString("d"));
                cmd.Parameters.AddWithValue("@DiscCode", DiscountCode);
                cmd.Parameters.AddWithValue("@DiscRemarks", DiscountRemarks);
                cmd.Parameters.AddWithValue("@Charge", Charge);
                cmd.Parameters.AddWithValue("@ChargeAmount", ChargeAmount);
                cmd.Parameters.AddWithValue("@ChargeCode", ChargeCode);
                cmd.Parameters.AddWithValue("@ChargeRemarks", ChargeRemarks);
                cmd.Parameters.AddWithValue("@ChargeType", ChargeType);
                cmd.Parameters.AddWithValue("@TransactionID", TransactionID);

                cmd.CommandText = SQL;
                base.ExecuteNonQuery(cmd);
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
		}
Пример #17
0
        public void UpdateDiscount(long POID, decimal DiscountApplied, DiscountTypes DiscountType, decimal Discount2Applied, DiscountTypes Discount2Type, decimal Discount3Applied, DiscountTypes Discount3Type)
        {
            try
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;
                
                string SQL = "UPDATE tblPO SET " +
                                "DiscountApplied        =   @DiscountApplied, " +
                                "DiscountType           =   @DiscountType, " +
                                "Discount2Applied       =   @Discount2Applied, " +
                                "Discount2Type          =   @Discount2Type, " +
                                "Discount3Applied       =   @Discount3Applied, " +
                                "Discount3Type          =   @Discount3Type " +
                            "WHERE POID = @POID;";

                cmd.Parameters.AddWithValue("@DiscountApplied", DiscountApplied);
                cmd.Parameters.AddWithValue("@DiscountType", Convert.ToInt16(DiscountType.ToString("d")));
                cmd.Parameters.AddWithValue("@Discount2Applied", Discount2Applied);
                cmd.Parameters.AddWithValue("@Discount2Type", Convert.ToInt16(Discount2Type.ToString("d")));
                cmd.Parameters.AddWithValue("@Discount3Applied", Discount3Applied);
                cmd.Parameters.AddWithValue("@Discount3Type", Convert.ToInt16(Discount3Type.ToString("d")));
                cmd.Parameters.AddWithValue("@POID", POID);

                cmd.CommandText = SQL;
                base.ExecuteNonQuery(cmd);
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Пример #18
0
        private void LoadChangeDiscount()
        {
            if (cboDiscountType.Text != null & cboDiscountType.Text != "")
            {
                Data.Discount clsDiscount = new Data.Discount();
                Data.DiscountDetails clsDiscountDetails = clsDiscount.Details(cboDiscountType.Text);
                clsDiscount.CommitAndDispose();

                //if (clsDiscountDetails.DiscountPrice == 0)
                //{
                //    mDiscountType = DiscountTypes.NotApplicable;
                //    lblHeader.Text = "Not Applicable";
                //    lblDiscountType.Visible = false;
                //}
                //else 
                lblHeader.Text = mstHeader;
                if (clsDiscountDetails.InPercent)
                {
                    mDiscountType = DiscountTypes.Percentage;
                    lblDiscountType.Visible = true;
                }
                else
                {
                    mDiscountType = DiscountTypes.FixedValue;
                    lblDiscountType.Visible = false;
                }

                txtAmount.Text = clsDiscountDetails.DiscountPrice.ToString("#,##0.#0");
            }
        }
Пример #19
0
        public void Void(Int64 TransactionID, decimal ItemSold, decimal QuantitySold, decimal GrossSales, decimal SubTotal, decimal NetSales, decimal ItemsDiscount, decimal SNRItemsDiscount, decimal PWDItemsDiscount, decimal OtherItemsDiscount, decimal Discount, decimal SNRDiscount, decimal PWDDiscount, decimal OtherDiscount, decimal TransDiscount, DiscountTypes TransDiscountType, decimal VAT, decimal VATableAmount, decimal ZeroRatedSales, decimal NonVATableAmount, decimal VATExempt, decimal EVAT, decimal EVATableAmount, decimal NonEVATableAmount, decimal LocalTax, decimal Charge, Int64 CashierID, string CashierName)
		{
			try
			{
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;

				string SQL = "UPDATE tblTransactions SET " +
								"TransactionStatus	=	@TransactionStatus, " +
                                "ItemSold		    =	@ItemSold, " +
                                "QuantitySold	    =	@QuantitySold, " +
                                "GrossSales		    =	@GrossSales, " +
								"SubTotal			=	@SubTotal, " +
                                "NetSales			=	@NetSales, " +
								"ItemsDiscount		=	@ItemsDiscount, " +
                                "SNRItemsDiscount	=	@SNRItemsDiscount, " +
                                "PWDItemsDiscount	=	@PWDItemsDiscount, " +
                                "OtherItemsDiscount	=	@OtherItemsDiscount, " +
								"Discount			=	@Discount, " +
                                "SNRDiscount		=	@SNRDiscount, " +
                                "PWDDiscount		=	@PWDDiscount, " +
                                "OtherDiscount		=	@OtherDiscount, " +
								"VAT				=	@VAT, " +
								"VATableAmount		=	@VATableAmount, " +
                                "ZeroRatedSales     =   @ZeroRatedSales, " +
                                "NonVATableAmount	=	@NonVATableAmount, " +
                                "VATExempt  		=	@VATExempt, " +
								"EVAT				=	@EVAT, " +
								"EVATableAmount		=	@EVATableAmount, " +
                                "NonEVATableAmount	=	@NonEVATableAmount, " +
								"LocalTax			=	@LocalTax, " +
								"DateClosed			=	NOW(), " +
								"Charge				=	@Charge, " +
								"CashierID			=	@CashierID, " +
								"CashierName		=	@CashierName, " +
                                "LastModified		=	NOW() " +
							"WHERE TransactionID	=	@TransactionID;";

                cmd.Parameters.AddWithValue("TransactionStatus", TransactionStatus.Void.ToString("d"));
                cmd.Parameters.AddWithValue("ItemSold", ItemSold);
                cmd.Parameters.AddWithValue("QuantitySold", QuantitySold);
                cmd.Parameters.AddWithValue("GrossSales", GrossSales);
                cmd.Parameters.AddWithValue("SubTotal", SubTotal);
                cmd.Parameters.AddWithValue("NetSales", NetSales);
                cmd.Parameters.AddWithValue("ItemsDiscount", ItemsDiscount);
                cmd.Parameters.AddWithValue("SNRItemsDiscount", SNRItemsDiscount);
                cmd.Parameters.AddWithValue("PWDItemsDiscount", PWDItemsDiscount);
                cmd.Parameters.AddWithValue("OtherItemsDiscount", OtherItemsDiscount);
                cmd.Parameters.AddWithValue("Discount", Discount);
                cmd.Parameters.AddWithValue("SNRDiscount", SNRDiscount);
                cmd.Parameters.AddWithValue("PWDDiscount", PWDDiscount);
                cmd.Parameters.AddWithValue("OtherDiscount", OtherDiscount);
                cmd.Parameters.AddWithValue("VAT", VAT);
                cmd.Parameters.AddWithValue("VATableAmount", VATableAmount);
                cmd.Parameters.AddWithValue("ZeroRatedSales", ZeroRatedSales);
                cmd.Parameters.AddWithValue("NonVATableAmount", NonVATableAmount);
                cmd.Parameters.AddWithValue("VATExempt", VATExempt);
                cmd.Parameters.AddWithValue("EVAT", EVAT);
                cmd.Parameters.AddWithValue("EVATableAmount", EVATableAmount);
                cmd.Parameters.AddWithValue("NonEVATableAmount", NonEVATableAmount);
                cmd.Parameters.AddWithValue("LocalTax", LocalTax);
                cmd.Parameters.AddWithValue("Charge", Charge);
                cmd.Parameters.AddWithValue("CashierID", CashierID);
                cmd.Parameters.AddWithValue("CashierName", CashierName);
                cmd.Parameters.AddWithValue("TransactionID", TransactionID);

                cmd.CommandText = SQL;
				base.ExecuteNonQuery(cmd);

				SalesTransactionItems clsSalesTransactionItems = new SalesTransactionItems(base.Connection, base.Transaction);
				clsSalesTransactionItems.VoidByTransaction(TransactionID);
			}
			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}
		}
Пример #20
0
        public void UpdateDiscountFreightDeposit(long WBranchTransferID, decimal DiscountApplied, DiscountTypes DiscountType)
        {
            try
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;

                string SQL = "UPDATE tblWBranchTransfer SET " +
                                "DiscountApplied        =   @DiscountApplied, " +
                                "DiscountType           =   @DiscountType " +
                            "WHERE WBranchTransferID = @WBranchTransferID;";

                cmd.Parameters.AddWithValue("@DiscountApplied", DiscountApplied);
                cmd.Parameters.AddWithValue("@DiscountType", DiscountType.ToString("d"));
                cmd.Parameters.AddWithValue("@WBranchTransferID", WBranchTransferID);

                cmd.CommandText = SQL;
                base.ExecuteNonQuery(cmd);
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Пример #21
0
        public Int64 AddItem(Int64 TransactionID, decimal ItemSold, decimal QuantitySold, decimal GrossSales, decimal SubTotal, decimal NetSales, decimal ItemsDiscount, decimal SNRItemsDiscount, decimal PWDItemsDiscount, decimal OtherItemsDiscount, decimal Discount, decimal SNRDiscount, decimal PWDDiscount, decimal OtherDiscount, decimal TransDiscount, DiscountTypes TransDiscountType, decimal VAT, decimal VATableAmount, decimal ZeroRatedSales, decimal NonVATableAmount, decimal VATExempt, decimal EVAT, decimal EVATableAmount, decimal NonEVATableAmount, decimal LocalTax, string DiscountCode, string DiscountRemarks, decimal Charge, decimal ChargeAmount, string ChargeCode, string ChargeRemarks, ChargeTypes ChargeType, SalesTransactionItemDetails SalesTransItemDetails)
		{
			try
			{
                UpdateSubTotal(TransactionID, ItemSold, QuantitySold, GrossSales, SubTotal, NetSales, ItemsDiscount, SNRItemsDiscount, PWDItemsDiscount, OtherItemsDiscount, Discount, SNRDiscount, PWDDiscount, OtherDiscount, TransDiscount, TransDiscountType, VAT, VATableAmount, ZeroRatedSales, NonVATableAmount, VATExempt, EVAT, EVATableAmount, NonEVATableAmount, LocalTax, DiscountCode, DiscountRemarks, Charge, ChargeAmount, ChargeCode, ChargeRemarks, ChargeType);

				SalesTransactionItems clsSalesTransactionItems = new SalesTransactionItems(base.Connection, base.Transaction);
				Int64 TransactionItemID = clsSalesTransactionItems.Insert(SalesTransItemDetails);

				return TransactionItemID;
			}
			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}
		}
Пример #22
0
        public void UpdateDiscount(long DebitMemoID, decimal DiscountApplied, DiscountTypes DiscountType, decimal Discount2Applied, DiscountTypes Discount2Type, decimal Discount3Applied, DiscountTypes Discount3Type)
        {
            try
            {
                string SQL = "UPDATE tblPODebitMemo SET " +
                                "DiscountApplied        =   @DiscountApplied, " +
                                "DiscountType           =   @DiscountType, " +
                                "Discount2Applied       =   @Discount2Applied, " +
                                "Discount2Type          =   @Discount2Type, " +
                                "Discount3Applied       =   @Discount3Applied, " +
                                "Discount3Type          =   @Discount3Type " +
                            "WHERE DebitMemoID = @DebitMemoID;";

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

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

                MySqlParameter prmDiscountType = new MySqlParameter("@DiscountType", MySqlDbType.Int16);
                prmDiscountType.Value = Convert.ToInt16(DiscountType.ToString("d"));
                cmd.Parameters.Add(prmDiscountType);

                MySqlParameter prmDiscount2Applied = new MySqlParameter("@Discount2Applied", MySqlDbType.Decimal);
                prmDiscount2Applied.Value = Discount2Applied;
                cmd.Parameters.Add(prmDiscount2Applied);

                MySqlParameter prmDiscount2Type = new MySqlParameter("@Discount2Type", MySqlDbType.Int16);
                prmDiscount2Type.Value = Convert.ToInt16(Discount2Type.ToString("d"));
                cmd.Parameters.Add(prmDiscount2Type);

                MySqlParameter prmDiscount3Applied = new MySqlParameter("@Discount3Applied", MySqlDbType.Decimal);
                prmDiscount3Applied.Value = Discount3Applied;
                cmd.Parameters.Add(prmDiscount3Applied);

                MySqlParameter prmDiscount3Type = new MySqlParameter("@Discount3Type", MySqlDbType.Int16);
                prmDiscount3Type.Value = Convert.ToInt16(Discount3Type.ToString("d"));
                cmd.Parameters.Add(prmDiscount3Type);

                MySqlParameter prmDebitMemoID = new MySqlParameter("@DebitMemoID", MySqlDbType.Int64);
                prmDebitMemoID.Value = DebitMemoID;
                cmd.Parameters.Add(prmDebitMemoID);

                base.ExecuteNonQuery(cmd);
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Пример #23
0
        protected void lstItem_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                DataRowView dr = (DataRowView)e.Item.DataItem;

                HtmlInputCheckBox chkList = (HtmlInputCheckBox)e.Item.FindControl("chkList");
                chkList.Value = dr["TransferOutItemID"].ToString();

                HyperLink lnkDescription = (HyperLink)e.Item.FindControl("lnkDescription");
                lnkDescription.Text        = dr["Description"].ToString();
                lnkDescription.NavigateUrl = Constants.ROOT_DIRECTORY + "/MasterFiles/_Product/Default.aspx?task=" + Common.Encrypt("det", Session.SessionID) + "&id=" + Common.Encrypt(dr["ProductID"].ToString(), Session.SessionID);

                HyperLink lnkMatrixDescription = (HyperLink)e.Item.FindControl("lnkMatrixDescription");
                if (dr["MatrixDescription"].ToString() == string.Empty || dr["MatrixDescription"].ToString() == null)
                {
                    lnkMatrixDescription.Text = "_";
                }
                else
                {
                    lnkMatrixDescription.Text        = dr["MatrixDescription"].ToString();
                    lnkMatrixDescription.NavigateUrl = Constants.ROOT_DIRECTORY + "/MasterFiles/_Product/_VariationsMatrix/Default.aspx?task=" + Common.Encrypt("det", Session.SessionID) + "&prodid=" + Common.Encrypt(dr["ProductID"].ToString(), Session.SessionID) + "&id=" + Common.Encrypt(dr["VariationMatrixID"].ToString(), Session.SessionID);
                }

                Label lblQuantity = (Label)e.Item.FindControl("lblQuantity");
                lblQuantity.Text = Convert.ToDecimal(dr["Quantity"].ToString()).ToString("#,##0.#0");

                Label lblProductUnitID = (Label)e.Item.FindControl("lblProductUnitID");
                lblProductUnitID.Text = dr["ProductUnitID"].ToString();

                Label lblProductUnitCode = (Label)e.Item.FindControl("lblProductUnitCode");
                lblProductUnitCode.Text = dr["ProductUnitCode"].ToString();

                Label lblUnitCost = (Label)e.Item.FindControl("lblUnitCost");
                lblUnitCost.Text = Convert.ToDecimal(dr["UnitCost"].ToString()).ToString("#,##0.#0");

                Label lblDiscountApplied = (Label)e.Item.FindControl("lblDiscountApplied");
                lblDiscountApplied.Text = Convert.ToDecimal(dr["DiscountApplied"].ToString()).ToString("#,##0.#0");

                DiscountTypes DiscountType = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), dr["DiscountType"].ToString());
                if (DiscountType == DiscountTypes.Percentage)
                {
                    Label lblPercent = (Label)e.Item.FindControl("lblPercent");
                    lblPercent.Visible = true;
                }

                Label lblAmount = (Label)e.Item.FindControl("lblAmount");
                lblAmount.Text = Convert.ToDecimal(dr["Amount"].ToString()).ToString("#,##0.#0");

                Label lblVAT = (Label)e.Item.FindControl("lblVAT");
                lblVAT.Text = Convert.ToDecimal(dr["VAT"].ToString()).ToString("#,##0.#0");

                Label lblEVAT = (Label)e.Item.FindControl("lblEVAT");
                lblEVAT.Text = Convert.ToDecimal(dr["EVAT"].ToString()).ToString("#,##0.#0");

                Label lblisVATInclusive = (Label)e.Item.FindControl("lblisVATInclusive");
                lblisVATInclusive.Text = Convert.ToBoolean(Convert.ToInt16(dr["isVATInclusive"].ToString())).ToString();

                Label lblLocalTax = (Label)e.Item.FindControl("lblLocalTax");
                lblLocalTax.Text = Convert.ToDecimal(dr["LocalTax"].ToString()).ToString("#,##0.#0");

                Label lblRemarks = (Label)e.Item.FindControl("lblRemarks");
                lblRemarks.Text = dr["Remarks"].ToString();

                //For anchor
                HtmlGenericControl divExpCollAsst = (HtmlGenericControl)e.Item.FindControl("divExpCollAsst");

                HtmlAnchor anchorDown = (HtmlAnchor)e.Item.FindControl("anchorDown");
                anchorDown.HRef = "javascript:ToggleDiv('" + divExpCollAsst.ClientID + "')";
            }
        }
Пример #24
0
        public void UpdateDiscountFreightDeposit(long DebitMemoID, decimal DiscountApplied, DiscountTypes DiscountType)
        {
            try
            {
                string SQL = "UPDATE tblPODebitMemo SET " +
                                "DiscountApplied        =   @DiscountApplied, " +
                                "DiscountType           =   @DiscountType " +
                            "WHERE DebitMemoID = @DebitMemoID;";

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

                cmd.Parameters.AddWithValue("@DiscountApplied", DiscountApplied);
                cmd.Parameters.AddWithValue("@DiscountType", Convert.ToInt16(DiscountType.ToString("d")));
                cmd.Parameters.AddWithValue("@DebitMemoID", DebitMemoID);

                base.ExecuteNonQuery(cmd);
            }

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