Exemple #1
0
        private void servicechargebutton_Click(object sender, EventArgs e)
        {
            Double MainFoodTotal = PartyReservation.MainGuestAmount+PartyReservation.OtherGuestAmount+PartyReservation.UtilityCostAmount;
            ChargeAmountForm tempChargeForm = new ChargeAmountForm();
            tempChargeForm.ShowDialog();

            if (ChargeAmountForm.m_serviceChargeType.Equals("Cancel"))
                return;

            m_chargeAmount = ChargeAmountForm.m_serviceChargeAmount;
            m_chargeType = ChargeAmountForm.m_serviceChargeType;

            Double chargeAmount = 0.000;
            Double servicechargeRate = 0.000;
            if (m_chargeType.Equals("Fixed"))
            {
                chargeAmount = m_chargeAmount;
                  if (MainFoodTotal != 0)
                {
                servicechargeRate = m_chargeAmount * 100 / MainFoodTotal;
                 }

            }
            else if (m_chargeType.Equals("Percent"))
            {

                chargeAmount = MainFoodTotal * m_chargeAmount / 100;

                servicechargeRate = m_chargeAmount;
            }

            ServiceCharge tempOrderCharge = new ServiceCharge();
            tempOrderCharge= aPartyReservationDao.OrderServiceChargeGetByOrderID(reservationId);
            if (tempOrderCharge.OrderID==reservationId)
            {

                //update
                tempOrderCharge.OrderID = reservationId;
                tempOrderCharge.ServiceChargeAmount = Convert.ToDouble(chargeAmount);
                tempOrderCharge.ServicechargeRate = servicechargeRate;
                aPartyReservationDao.UpdateOrderServiceCharge(tempOrderCharge);
            }

            else
            {
                //insert
                tempOrderCharge.OrderID = reservationId;
                tempOrderCharge.ServiceChargeAmount = Convert.ToDouble(chargeAmount);
                tempOrderCharge.ServicechargeRate = servicechargeRate;
                aPartyReservationDao.InsertOrderServiceCharge(tempOrderCharge);
            }
            PartyReservation.ServiceCharge = chargeAmount;
            servicechargelabel.Text = chargeAmount.ToString("F02");
            LoadTotalPayable();
        }
Exemple #2
0
        private void g_ServiceChargeButton_Click(object sender, EventArgs e)
        {
            Double MainFoodTotal = 0;//@Salim Only for Main Item with out additional service charge or discount
            Double tempTotal = 0.0;
            for (int rowIndex = 0; rowIndex < g_FoodDataGridView.Rows.Count; rowIndex++)
            {
                if (g_FoodDataGridView[3, rowIndex].Value != null && !g_FoodDataGridView[3, rowIndex].Value.ToString().Equals(""))
                {
                    tempTotal += Double.Parse(g_FoodDataGridView[3, rowIndex].Value.ToString());
                }
            }
            for (int rowIndex = 0; rowIndex < g_BeverageDataGridView.Rows.Count; rowIndex++)
            {
                if (g_BeverageDataGridView[3, rowIndex].Value != null && !g_BeverageDataGridView[3, rowIndex].Value.ToString().Equals(""))
                {
                    tempTotal += Double.Parse(g_BeverageDataGridView[3, rowIndex].Value.ToString());
                }
            }
            MainFoodTotal = tempTotal;
            ChargeAmountForm tempChargeForm = new ChargeAmountForm();//Change by Mithu
            tempChargeForm.ShowDialog(); //Change by Mithu

            //ServiceChargeControl objSvcCtl = new ServiceChargeControl(this);//Change by Mithu
            //g_ItemSelectionFlowLayoutPanel.Controls.Clear();//Change by Mithu
            //g_ItemSelectionFlowLayoutPanel.Controls.Add(objSvcCtl);//Change by Mithu

            if (ChargeAmountForm.m_serviceChargeType.Equals("Cancel"))//Change by Mithu
                return;

            m_chargeAmount = ChargeAmountForm.m_serviceChargeAmount;//Change by Mithu
            m_chargeType = ChargeAmountForm.m_serviceChargeType;//Change by Mithu

            Double chargeAmount = 0.000;
            Double servicechargeRate = 0.000;
            if (m_chargeType.Equals("Fixed"))//Change by Mithu
            {
                chargeAmount = m_chargeAmount;//Change by Mithu

                servicechargeRate =  m_chargeAmount * 100 / MainFoodTotal;//Change by Mithu

            }
            else if (m_chargeType.Equals("Percent"))//Change by Mithu
            {
              chargeAmount = tempTotal * m_chargeAmount / 100;//Change by Mithu

            //chargeAmount = MainFoodTotal * 10 / 100; // Change by Mithu
              chargeAmount = MainFoodTotal * m_chargeAmount / 100;

              servicechargeRate = m_chargeAmount;
            }//Change by Mithu
            COrderManager tempOrderManager = new COrderManager();
            ServiceCharge tempOrderCharge = new ServiceCharge();
            CResult cResult = tempOrderManager.OrderServiceChargeGetByOrderID(orderID);
            if (cResult.IsSuccess && cResult.Data != null)
            {
                tempOrderCharge = (ServiceCharge)cResult.Data;

                //update
                tempOrderCharge.OrderID = orderID;
                tempOrderCharge.ServiceChargeAmount = Convert.ToDouble(chargeAmount);
                tempOrderCharge.ServicechargeRate = servicechargeRate;
                tempOrderManager.UpdateOrderServiceCharge(tempOrderCharge);
            }

            else
            {
                //insert
                tempOrderCharge.OrderID = orderID;
                tempOrderCharge.ServiceChargeAmount = Convert.ToDouble(chargeAmount);
                tempOrderCharge.ServicechargeRate = servicechargeRate;
                tempOrderManager.InsertOrderServiceCharge(tempOrderCharge);
            }

            serviceCharge = chargeAmount.ToString("F02"); //Service charge amount
            g_serviceCharge.Text = chargeAmount.ToString("F02");

            tempTotal = (tempTotal + double.Parse(g_serviceCharge.Text) - double.Parse(g_DiscountLabel.Text));
            //Field for vat
              //  lblVat.Text = (MainFoodTotal * (vat / 100)).ToString("F02");

            //  g_AmountLabel.Text = (tempTotal + double.Parse(g_serviceCharge.Text) - double.Parse(g_DiscountLabel.Text)).ToString(); //Deduct the discount amount

            // g_AmountLabel.Text = (tempTotal * (1 + (vat / 100))).ToString("F02");
            g_AmountLabel.Text = (MainFoodTotal + double.Parse(lblVat.Text) + double.Parse(g_serviceCharge.Text) - double.Parse(g_DiscountLabel.Text)).ToString("F02");
               // this.ServiceChargeModification();
        }