Esempio n. 1
0
        private void discountbutton_Click(object sender, EventArgs e)
        {
            double discountRate = 0.0;
            Double MainFoodTotal = PartyReservation.MainGuestAmount + PartyReservation.OtherGuestAmount + PartyReservation.UtilityCostAmount;
            CDiscountForm tempDiscountForm = new CDiscountForm();
            tempDiscountForm.ShowDialog();

            if (CDiscountForm.discountType.Equals("Cancel"))
                return;

            m_dDiscountAmount = Convert.ToDecimal(CDiscountForm.discountAmount);
            m_sDiscountType = CDiscountForm.discountType;

               double  discountAmount = 0;
            if (m_sDiscountType.Equals("Fixed"))
            {
                discountAmount = (double)m_dDiscountAmount;
                if (MainFoodTotal != 0)
                {
                    discountRate = m_chargeAmount*100/MainFoodTotal;
                }

            }
            else if (m_sDiscountType.Equals("Percent"))
            {
                discountAmount =MainFoodTotal*(double) m_dDiscountAmount / 100;

                discountRate =(double)m_dDiscountAmount;

            }

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

                //update
                tempOrderCharge.OrderID = reservationId;
                tempOrderCharge.ServiceChargeAmount = Convert.ToDouble(discountAmount);
                tempOrderCharge.ServicechargeRate = discountRate;
                aPartyReservationDao.UpdateOrderDiscount(tempOrderCharge);
            }

            else
            {
                //insert
                tempOrderCharge.OrderID = reservationId;
                tempOrderCharge.ServiceChargeAmount = Convert.ToDouble(discountAmount);
                tempOrderCharge.ServicechargeRate = discountRate;
                aPartyReservationDao.InsertOrderDiscount(tempOrderCharge);
            }
            PartyReservation.Discount = discountAmount;
            discountlabel.Text = discountAmount.ToString("F02");
            LoadTotalPayable();
        }
Esempio n. 2
0
        private void functionalButton1_Click_2(object sender, EventArgs e)
        {
            CResult aCResult = new CResult();
              CUserInfoDAO aUserInfoDao = new CUserInfoDAO();
              CUserInfo aUserInfo = new CUserInfo();
              aUserInfo.UserID = RMSGlobal.m_iLoginUserID;
              aCResult = aUserInfoDao.GetUser(aUserInfo);
              aUserInfo = (CUserInfo)aCResult.Data;

              if (aUserInfo.Type != 0)
              {
              MessageBox.Show("You are not correct person to give Item Complementory Opportunity");
              return;
              }

              CDiscountForm tempDiscountForm = new CDiscountForm();
              tempDiscountForm.ShowDialog();

              if (CDiscountForm.discountType.Equals("Cancel"))
              return;

            double   discountAmount = Convert.ToDouble(CDiscountForm.discountAmount);
            string   discountType = CDiscountForm.discountType;

              COrderDetailsDAO aOrderInfoDao = new COrderDetailsDAO();
              foreach (DataGridViewRow row in g_FoodDataGridView.Rows)
              {

              if (Convert.ToBoolean(row.Cells["complementoryfood"].Value) == true)
              {
                  COrderDetails aCOrderDetails = new COrderDetails();

                  aCOrderDetails.OrderDetailsID = Convert.ToInt64(row.Cells["Order_details_id"].Value);

                  aCOrderDetails = aOrderInfoDao.OrderDetailsGetByOrderDetailID(aCOrderDetails.OrderDetailsID);

                  double totalAmount = aCOrderDetails.UnitPrice*aCOrderDetails.OrderQuantity;
                  double discount=0;
                  if (discountType == "Fixed")
                  {
                      discount = discountAmount;
                  } else
                  {
                      discount = (totalAmount*discountAmount)/100.0;
                  }

                  aCOrderDetails.DiscountAmount = discount;

                  string result = aOrderInfoDao.UpdateItemWiseDiscountForItem(aCOrderDetails);

              }

              }

              foreach (DataGridViewRow row in g_BeverageDataGridView.Rows)
              {

              if (Convert.ToBoolean(row.Cells["complementorynonfood"].Value) == true)
              {
                  COrderDetails aCOrderDetails = new COrderDetails();
                  aCOrderDetails.OrderDetailsID = Convert.ToInt64(row.Cells["dataGridViewTextBoxColumn5"].Value);
                  aCOrderDetails = aOrderInfoDao.OrderDetailsGetByOrderDetailID(aCOrderDetails.OrderDetailsID);
                  double totalAmount = aCOrderDetails.UnitPrice * aCOrderDetails.OrderQuantity;
                  double discount = 0;
                  if (discountType == "Fixed")
                  {
                      discount = discountAmount;
                  }
                  else
                  {
                      discount = (totalAmount * discountAmount) / 100.0;
                  }

                  aCOrderDetails.DiscountAmount = discount;
                  string result = aOrderInfoDao.UpdateItemWiseDiscountForItem(aCOrderDetails);

              }

              }

              CResult oResult1 = aOrderInfoDao.OrderDetailsGetByOrderID(orderID);
             List<COrderDetails> aOrderDetailses = oResult1.Data as List<COrderDetails>;
              double totalItemDiscount = 0;
              if (aOrderDetailses != null)
              {
               totalItemDiscount = aOrderDetailses.Sum(a => a.DiscountAmount);
              }

              COrderManager tempOrderManager = new COrderManager();
              COrderDiscount tempOrderDiscount = new COrderDiscount();
              CResult oResult = tempOrderManager.OrderDiscountGetByOrderID(orderID);
              if (oResult.IsSuccess && oResult.Data != null)
              {

              tempOrderDiscount = (COrderDiscount)oResult.Data;

              tempOrderDiscount.TotalItemDiscount = totalItemDiscount;
              tempOrderManager.UpdateOrderDiscount(tempOrderDiscount);

              }
              else
              {
              //insert
              tempOrderDiscount.OrderID = orderID;
              tempOrderDiscount.TotalItemDiscount = totalItemDiscount;
              tempOrderManager.InsertOrderDiscount(tempOrderDiscount);
              }

              LoadOrderDetails();
        }
Esempio n. 3
0
        private void g_PromotionsButton_Click(object sender, EventArgs e)
        {
            CResult aCResult=new CResult();
            CUserInfoDAO aUserInfoDao=new CUserInfoDAO();
            CUserInfo aUserInfo = new CUserInfo();
            aUserInfo.UserID = RMSGlobal.m_iLoginUserID;
            aCResult = aUserInfoDao.GetUser(aUserInfo);
            aUserInfo = (CUserInfo)aCResult.Data;

            if (aUserInfo.Type != 0)
            {
                MessageBox.Show("You are not correct person to give discount");
                return;
            }

            //CDiscountForm tempDiscountForm = new CDiscountForm();
            //tempDiscountForm.ShowDialog();

            //if (CDiscountForm.discountType.Equals("Cancel"))
            //    return;

            //m_dDiscountAmount = Convert.ToDecimal(CDiscountForm.discountAmount);
            //m_sDiscountType = CDiscountForm.discountType;
            //double discountAmount = 0;

            //List<COrderDetails> aCOrderDetailses=new List<COrderDetails>();
            //foreach (DataGridViewRow row in g_FoodDataGridView.Rows)
            //{

            //    if(Convert.ToBoolean(row.Cells["foodselect"].Value)==true)
            //    {
            //        COrderDetails aCOrderDetails=new COrderDetails();
            //        aCOrderDetails.ProductID = Convert.ToInt32(row.Cells["Cat_id"].Value);
            //        aCOrderDetails.OrderQuantity = Convert.ToInt32(row.Cells["Qty"].Value);
            //        aCOrderDetails.UnitPrice = Convert.ToDouble(row.Cells["unitPrice"].Value);
            //        aCOrderDetails.OrderDetailsID = Convert.ToInt64(row.Cells["Order_details_id"].Value);
            //        aCOrderDetails.OrderAmount = Convert.ToDouble(row.Cells["Price"].Value);
            //        aCOrderDetails.DiscountAmount = (((double)m_dDiscountAmount)*aCOrderDetails.OrderAmount)/100;
            //        discountAmount += aCOrderDetails.DiscountAmount;
            //        aCOrderDetailses.Add(aCOrderDetails);

            //    }

            //}

            //foreach (DataGridViewRow row in g_BeverageDataGridView.Rows)
            //{

            //    if (Convert.ToBoolean(row.Cells["nonfoodselect"].Value) == true)
            //    {
            //        COrderDetails aCOrderDetails = new COrderDetails();
            //        aCOrderDetails.OrderDetailsID = Convert.ToInt64(row.Cells["dataGridViewTextBoxColumn5"].Value);
            //        aCOrderDetails.OrderAmount = Convert.ToDouble(row.Cells["dataGridViewTextBoxColumn7"].Value);
            //        aCOrderDetails.DiscountAmount = (((double)m_dDiscountAmount) * aCOrderDetails.OrderAmount) / 100;
            //        discountAmount += aCOrderDetails.DiscountAmount;
            //        aCOrderDetailses.Add(aCOrderDetails);

            //    }

            //}
            //COrderDetailsDAO aOrderDetailsDao=new COrderDetailsDAO();
            //string result = aOrderDetailsDao.UpdateItemWiseDiscount(aCOrderDetailses);
            //MessageBox.Show(result);

             //COrderManager tempOrderManager = new COrderManager();
             //   COrderDiscount tempOrderDiscount = new COrderDiscount();
             //   CResult oResult = tempOrderManager.OrderDiscountGetByOrderID(orderID);
             //   if (oResult.IsSuccess && oResult.Data != null)
             //   {

             //       tempOrderDiscount = (COrderDiscount)oResult.Data;

             //       if (membership != null && membership.id > 0)
             //       {
             //           tempOrderDiscount.clientID = membership.customerID;
             //           tempOrderDiscount.membershipCardID = membership.mebershipCardID;
             //           tempOrderDiscount.membershipID = membership.id;
             //           tempOrderDiscount.membershipPoint = membership.point;
             //           tempOrderDiscount.membershipDiscountRate = membership.discountPercentRate;

             //       }

             //       //update
             //        tempOrderDiscount.Discount = Convert.ToDouble(discountAmount);
             //       tempOrderManager.UpdateOrderDiscount(tempOrderDiscount);

             //   }
             //   else
             //   {
             //       //insert
             //       tempOrderDiscount.OrderID = orderID;
             //         tempOrderDiscount.Discount = Convert.ToDouble(discountAmount);

             //       if (membership != null && membership.id > 0)
             //       {
             //           tempOrderDiscount.clientID = membership.customerID;
             //           tempOrderDiscount.membershipCardID = membership.mebershipCardID;
             //           tempOrderDiscount.membershipID = membership.id;
             //           tempOrderDiscount.membershipPoint = membership.point;
             //           tempOrderDiscount.membershipDiscountRate = membership.discountPercentRate;

             //       }

             //       tempOrderManager.InsertOrderDiscount(tempOrderDiscount);
             //   }

            CDiscountForm tempDiscountForm = new CDiscountForm();
            tempDiscountForm.ShowDialog();

            if (CDiscountForm.discountType.Equals("Cancel"))
                return;

            m_dDiscountAmount = Convert.ToDecimal(CDiscountForm.discountAmount);
            m_sDiscountType = CDiscountForm.discountType;
            TotalAmountCalculation();
        }
Esempio n. 4
0
        private void g_PromotionsButton_Click(object sender, EventArgs e)
        {
            CDiscountForm tempDiscountForm = new CDiscountForm();
            tempDiscountForm.ShowDialog();

            if (CDiscountForm.discountType.Equals("Cancel"))
                return;

            m_dDiscountAmount = CDiscountForm.discountAmount;
            m_sDiscountType = CDiscountForm.discountType;
            TotalAmountCalculation();
        }