Example #1
0
		public void Update(ChargeTypeDetails Details)
		{
			try 
			{
				string SQL=	"UPDATE tblChargeType SET " + 
					"ChargeTypeCode	= @ChargeTypeCode, " +  
					"ChargeType = @ChargeType, " +  
					"ChargeAmount = @ChargeAmount, " +  
					"InPercent = @InPercent " +  
					"WHERE ChargeTypeID = " + Details.ChargeTypeID + ";";

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

                cmd.Parameters.AddWithValue("@ChargeTypeCode", Details.ChargeTypeCode);
                cmd.Parameters.AddWithValue("@ChargeType", Details.ChargeType);
                cmd.Parameters.AddWithValue("@ChargeAmount", Details.ChargeAmount);
                cmd.Parameters.AddWithValue("@InPercent", Details.InPercent);
                cmd.Parameters.AddWithValue("@ChargeTypeID", Details.ChargeTypeID);

				base.ExecuteNonQuery(cmd);
			}

			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
Example #2
0
		public Int32 Insert(ChargeTypeDetails Details)
		{
			try 
			{
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;
				
				string SQL = "INSERT INTO tblChargeType (ChargeTypeCode, ChargeType, ChargeAmount, InPercent) " +
					"VALUES (@ChargeTypeCode, @ChargeType, @ChargeAmount, @InPercent) ;";
				  
                cmd.Parameters.AddWithValue("@ChargeTypeCode", Details.ChargeTypeCode);
                cmd.Parameters.AddWithValue("@ChargeType", Details.ChargeType);
                cmd.Parameters.AddWithValue("@ChargeAmount", Details.ChargeAmount);
                cmd.Parameters.AddWithValue("@InPercent", Details.InPercent);

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

                return Int32.Parse(base.getLAST_INSERT_ID(this));
			}
			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
Example #3
0
		private Int32 SaveRecord()
		{
			ChargeType clsChargeType = new ChargeType();
			ChargeTypeDetails clsDetails = new ChargeTypeDetails();

            clsDetails.ChargeTypeCode = txtChargeTypeCode.Text;
            clsDetails.ChargeType = txtChargeType.Text;
            clsDetails.ChargeAmount = Convert.ToDecimal(txtChargeAmount.Text);
            clsDetails.InPercent = chkInPercent.Checked;
		
			Int32 id = clsChargeType.Insert(clsDetails);
			
			clsChargeType.CommitAndDispose();

			return id;
		}
Example #4
0
        private void SaveRecord()
        {
            ChargeType clsChargeType = new ChargeType();
            ChargeTypeDetails clsDetails = new ChargeTypeDetails();

            clsDetails.ChargeTypeCode = txtChargeTypeCode.Text;
            clsDetails.ChargeType = txtChargeType.Text;
            clsDetails.ChargeAmount = Convert.ToDecimal(txtChargeAmount.Text);
            clsDetails.InPercent = chkInPercent.Checked;
            clsDetails.ChargeTypeID = Convert.ToInt32(lblChargeTypeID.Text);

            clsChargeType.Update(clsDetails);
            clsChargeType.CommitAndDispose();
        }
Example #5
0
        public ChargeTypeDetails Details(string ChargeTypeCode)
        {
            try
            {
                string SQL = SQLSelect() + "WHERE ChargeTypeCode = @ChargeTypeCode;";

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

                cmd.Parameters.AddWithValue("@ChargeTypeCode", ChargeTypeCode);

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

                ChargeTypeDetails Details = new ChargeTypeDetails();
                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    Details.ChargeTypeID = Int32.Parse(dr["ChargeTypeID"].ToString());
                    Details.ChargeTypeCode = dr["ChargeTypeCode"].ToString();
                    Details.ChargeType = dr["ChargeType"].ToString();
                    Details.ChargeAmount = decimal.Parse(dr["ChargeAmount"].ToString());
                    Details.InPercent = bool.Parse(dr["InPercent"].ToString());

                    Details.CreatedOn = DateTime.Parse(dr["CreatedOn"].ToString());
                    Details.LastModified = DateTime.Parse(dr["LastModified"].ToString());
                }

                return Details;
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Example #6
0
        public Int32 Save(ChargeTypeDetails Details)
        {
            try
            {
                string SQL = "CALL procSaveChargeType(@ChargeTypeID, @ChargeTypeCode, @ChargeType, @ChargeAmount, @InPercent, @CreatedOn, @LastModified);";

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

                cmd.Parameters.AddWithValue("ChargeTypeID", Details.ChargeTypeID);
                cmd.Parameters.AddWithValue("ChargeTypeCode", Details.ChargeTypeCode);
                cmd.Parameters.AddWithValue("ChargeType", Details.ChargeType);
                cmd.Parameters.AddWithValue("ChargeAmount", Details.ChargeAmount);
                cmd.Parameters.AddWithValue("InPercent", Details.InPercent);
                cmd.Parameters.AddWithValue("CreatedOn", Details.CreatedOn == DateTime.MinValue ? Constants.C_DATE_MIN_VALUE : Details.CreatedOn);
                cmd.Parameters.AddWithValue("LastModified", Details.LastModified == DateTime.MinValue ? Constants.C_DATE_MIN_VALUE : Details.LastModified);

                return base.ExecuteNonQuery(cmd);
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Example #7
0
		private void ChangeOrderType()
		{
            if (mclsTerminalDetails.AutoPrint == PrintingPreference.Auto && mboIsInTransaction)
            {
                MessageBox.Show("Sorry you cannot change Order Type if Auto-print is ON an item is already purchased.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            DialogResult loginresult = GetWriteAccessAndLogin(mclsSalesTransactionDetails.CashierID, AccessTypes.ChangeOrderType);

            if (loginresult == DialogResult.OK)
            {
                try
                {
                    clsEvent.AddEvent("[" + lblCashier.Text + "] Changing order type of trans. no. " + lblTransNo.Text);

                    OrderTypeWnd clsOrderTypeWnd = new OrderTypeWnd();
                    clsOrderTypeWnd.TerminalDetails = mclsTerminalDetails;
                    clsOrderTypeWnd.ShowDialog(this);
                    DialogResult result = clsOrderTypeWnd.Result;
                    OrderTypes clsOrderType = clsOrderTypeWnd.orderType;
                    clsOrderTypeWnd.Close();
                    clsOrderTypeWnd.Dispose();

                    if (result == DialogResult.OK)
                    {
                        Cursor.Current = Cursors.WaitCursor;
                        if (!mboIsInTransaction)
                        {
                            this.LoadOptions();
                            if (!this.CreateTransaction()) return;
                        }

                        mclsSalesTransactionDetails.OrderType = clsOrderType;

                        Data.SalesTransactions clsSalesTransactions = new Data.SalesTransactions(mConnection, mTransaction);
                        mConnection = clsSalesTransactions.Connection; mTransaction = clsSalesTransactions.Transaction;

                        clsSalesTransactions.UpdateOrderType(mclsSalesTransactionDetails.TransactionID, mclsSalesTransactionDetails.TransactionDate, mclsSalesTransactionDetails.OrderType);
                        InsertAuditLog(AccessTypes.ChargeType, "Change order type to " + mclsSalesTransactionDetails.OrderType.ToString("G") + ". Tran. #".PadRight(15) + ":" + lblTransNo.Text + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode);
                        clsEvent.AddEventLn("Done!", true);

                        if (clsOrderType != OrderTypes.DineIn && mclsSalesTransactionDetails.CustomerID == Constants.C_RETAILPLUS_CUSTOMERID)
                        {
                            Int64 iOldContactID = mclsSalesTransactionDetails.CustomerID;

                            SelectContact(AceSoft.RetailPlus.Data.ContactGroupCategory.CUSTOMER);

                            if (iOldContactID != mclsSalesTransactionDetails.CustomerID)
                            {
                                Data.Contacts clsContacts = new Data.Contacts(mConnection, mTransaction);
                                mConnection = clsContacts.Connection; mTransaction = clsContacts.Transaction;
                                clsContacts.UpdateLastCheckInDate(iOldContactID, Constants.C_DATE_MIN_VALUE);
                                clsContacts.UpdateLastCheckInDate(mclsSalesTransactionDetails.CustomerID, mclsSalesTransactionDetails.TransactionDate);
                                clsContacts.CommitAndDispose();
                            }
                        }
                        if (mclsSalesTransactionDetails.CustomerID == Constants.C_RETAILPLUS_CUSTOMERID)
                        {
                            mclsSalesTransactionDetails.OrderType = OrderTypes.DineIn;

                            clsSalesTransactions = new Data.SalesTransactions(mConnection, mTransaction);
                            mConnection = clsSalesTransactions.Connection; mTransaction = clsSalesTransactions.Transaction;

                            clsSalesTransactions.UpdateOrderType(mclsSalesTransactionDetails.TransactionID, mclsSalesTransactionDetails.TransactionDate, mclsSalesTransactionDetails.OrderType);
                            InsertAuditLog(AccessTypes.ChargeType, "System override order type to " + mclsSalesTransactionDetails.OrderType.ToString("G") + ". Tran. #".PadRight(15) + ":" + lblTransNo.Text + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode);
                        
                        }

                        clsSalesTransactions.CommitAndDispose();

                        lblOrderType.Text = mclsSalesTransactionDetails.OrderType.ToString("G").ToUpper();

                        // [09/24/2014] apply the default charge if changed to dine in

                        Data.ChargeType clsChargeType = new ChargeType(mConnection, mTransaction);
                        mConnection = clsChargeType.Connection; mTransaction = clsChargeType.Transaction;

                        Data.ChargeTypeDetails clsChargeTypeDetails = new ChargeTypeDetails();
                        if (mclsSalesTransactionDetails.OrderType == OrderTypes.DineIn && !string.IsNullOrEmpty(mclsTerminalDetails.DineInChargeCode))
                        {
                            clsChargeTypeDetails = clsChargeType.Details(mclsTerminalDetails.DineInChargeCode);
                            setTransCharge(clsChargeTypeDetails, "Change Order Type to Dine-In. Charge Code:" + mclsTerminalDetails.DineInChargeCode);
                        }
                        else if (mclsSalesTransactionDetails.OrderType == OrderTypes.TakeOut && !string.IsNullOrEmpty(mclsTerminalDetails.TakeOutChargeCode))
                        {
                            clsChargeTypeDetails = clsChargeType.Details(mclsTerminalDetails.TakeOutChargeCode);
                            setTransCharge(clsChargeTypeDetails, "Change Order Type to Take-Out. Charge Code:" + mclsTerminalDetails.TakeOutChargeCode);
                        }
                        else if (mclsSalesTransactionDetails.OrderType == OrderTypes.Delivery && !string.IsNullOrEmpty(mclsTerminalDetails.DeliveryChargeCode))
                        {
                            clsChargeTypeDetails = clsChargeType.Details(mclsTerminalDetails.DeliveryChargeCode);
                            setTransCharge(clsChargeTypeDetails, "Change Order Type to Delivery. Charge Code:" + mclsTerminalDetails.DeliveryChargeCode);
                        }
                        else
                        {
                            ApplyTransZeroCharge();
                        }

                        clsChargeType.CommitAndDispose();
                    }
                    else { clsEvent.AddEventLn("Cancelled!"); }
                }
                catch (Exception ex)
                {
                    InsertErrorLogToFile(ex, "ERROR!!! Changing order type.");
                }
                Cursor.Current = Cursors.Default;
            }
		}