Ejemplo n.º 1
0
 private void BTN_SAVE_Click(object sender, EventArgs e)
 {
     if (TXT_MP_NAME.Text == string.Empty)
     {
         TXT_MP_NAME.Focus();
         MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "PLEASE ENTER MEAL PLAN NAME", MessageAlertImage.Warning());
         mdg.ShowDialog();
     }
     else
     {
         if (BTN_SAVE.Text == "SAVE")
         {
             string result = SAVE_MEAL_PLAN();
             if (result == "done")
             {
                 MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "MEAL PLAN ADDED SUCCESSFULLY!", MessageAlertImage.Success());
                 mdg.ShowDialog();
                 DisableControls();
             }
         }
         else
         {
             string result = UPDATE_MEAL_PLAN();
             if (result == "done")
             {
                 MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "PACKAGE DETAILS UPDATED SUCCESSFULLY!", MessageAlertImage.Success());
                 mdg.ShowDialog();
             }
         }
         LOAD_MEAP_PLAN_lIST();
     }
 }
Ejemplo n.º 2
0
        private void BTN_SAVE_Click(object sender, EventArgs e)
        {
            if (TXT_PKG_NAME.Text == string.Empty)
            {
                TXT_PKG_NAME.Focus();
                MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "PLEASE ENTER PACKAGE NAME", MessageAlertImage.Warning());
                mdg.ShowDialog();
            }
            else if (CMB_ROOM_TYPE.SelectedIndex < 0)
            {
                CMB_ROOM_TYPE.Focus();
                MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "PLEASE SELECT ROOM TYPE", MessageAlertImage.Warning());
                mdg.ShowDialog();
            }
            else
            {
                if (BTN_SAVE.Text == "SAVE")
                {
                    SAVE_ROOM_PACKAGE();
                }
                else if (BTN_SAVE.Text == "UPDATE")
                {
                    string result = UPDATE_PACKAGE();
                    if (result == "done")
                    {
                        MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "PACKAGE DETAILS UPDATED SUCCESSFULLY!", MessageAlertImage.Success());
                        mdg.ShowDialog();
                        LOAD_PACKAGE_LIST();
                    }
                }


                LOAD_PACKAGE_LIST();
            }
        }
Ejemplo n.º 3
0
        private void UPDATE_CLEAN_SERVICE()
        {
            try
            {
                CONNECTION.open_connection();

                using (MySqlCommand DA = new MySqlCommand("UPDATE room SET current_status=@current_status WHERE room_id=@room_id", CONNECTION.CON))
                {
                    DA.Parameters.Clear();
                    DA.Parameters.AddWithValue("@room_id", DGV_LIST.SelectedRows[0].Cells[1].Value.ToString());
                    DA.Parameters.AddWithValue("@current_status", "AVAILABLE");
                    DA.ExecuteNonQuery();
                }

                using (MySqlCommand DA = new MySqlCommand("UPDATE recerved_rooms SET house_keeping=@house_keeping WHERE reservation_no=@reservation_id AND room_id=@room_id", CONNECTION.CON))
                {
                    DA.Parameters.Clear();
                    DA.Parameters.AddWithValue("@reservation_id", DGV_LIST.SelectedRows[0].Cells[0].Value.ToString());
                    DA.Parameters.AddWithValue("@house_keeping", "Yes");
                    DA.Parameters.AddWithValue("@room_id", DGV_LIST.SelectedRows[0].Cells[1].Value.ToString());
                    DA.ExecuteNonQuery();
                    MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "SELECTED ROOM CLEAN!", MessageAlertImage.Success());
                    mdg.ShowDialog();
                }
            }
            catch (Exception EX)
            {
                MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), EX.Message, MessageAlertImage.Error());
                mdg.ShowDialog();
            }
        }
        private void BTN_OK_Click_1(object sender, EventArgs e)
        {
            if (BTN_OK.ButtonText == "SAVE")
            {
                SAVE_ORDER = true;
                if (TXT_SP_NOTE.Text == string.Empty)
                {
                    SP_NOTE = "-";
                }
                else
                {
                    SP_NOTE = TXT_SP_NOTE.Text;
                }
            }
            else
            {
                string result = UPDATE_NOTE();
                if (result == "done")
                {
                    MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "ORDER NOTE UPDATED SUCCESSFULLY", MessageAlertImage.Success());
                    mdg.ShowDialog();
                    this.Close();
                }
            }

            this.Close();
        }
Ejemplo n.º 5
0
 private void BTN_REMOVE_Click(object sender, EventArgs e)
 {
     CONNECTION.open_connection();
     try
     {
         foreach (DataGridViewRow dr in DGV_ADD_SERVICE.SelectedRows)
         {
             using (MySqlCommand deleteservice = new MySqlCommand("DELETE FROM additional_service WHERE id=@id", CONNECTION.CON))
             {
                 deleteservice.Parameters.AddWithValue("@id", dr.Cells[0].Value.ToString());
                 int n1 = deleteservice.ExecuteNonQuery();
                 if (n1 == 1)
                 {
                     DISPLAY_ADDED_SERVICES(Reservation_id, Room_id);
                     MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "Removed Successfully", MessageAlertImage.Success());
                     mdg.ShowDialog();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), ex.Message, MessageAlertImage.Error());
         mdg.ShowDialog();
     }
     finally
     {
         CONNECTION.close_connection();
     }
 }
 private void BTN_SAVE_Click(object sender, EventArgs e)
 {
     if (TXT_SV_NAME.Text == string.Empty)
     {
         TXT_SV_NAME.Focus();
         MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "PLEASE ENTER SERVICE NAME", MessageAlertImage.Warning());
         mdg.ShowDialog();
     }
     else
     {
         if (BTN_SAVE.Text == "SAVE")
         {
             string result = SAVE_SERVICE();
             if (result == "done")
             {
                 MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "ADDITIONAL SERVICE ADDED SUCCESSFULLY!", MessageAlertImage.Success());
                 mdg.ShowDialog();
                 DisableControls();
             }
         }
         else if (BTN_SAVE.Text == "UPDATE")
         {
             string result = UPDATE_SERVICE_DETAILS();
             if (result == "done")
             {
                 MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "SERVICE DETAILS UPDATED SUCCESSFULLY!", MessageAlertImage.Success());
                 mdg.ShowDialog();
             }
         }
         LOAD_SERVICE_lIST();
     }
 }
Ejemplo n.º 7
0
        private void SAVE_ITEMS()
        {
            //try
            //{
            CONNECTION.open_connection();
            using (MySqlCommand da = new MySqlCommand("INSERT INTO item (barcode,item_category,item_name,item_status) VALUES(@barcode,@item_category,@item_name,@item_status)", CONNECTION.CON))
            {
                da.Parameters.Clear();
                da.Parameters.AddWithValue("@barcode", "N/A");
                da.Parameters.AddWithValue("@item_category", CMB_CATEGORY.SelectedValue);
                da.Parameters.AddWithValue("@item_name", TXT_ITEMNAME.Text);
                da.Parameters.AddWithValue("@item_status", "ENABLE");
                if (da.ExecuteNonQuery() > 0)
                {
                    LBL_ITEM_ID.Text = GETMAXID();
                    if (TXT_BARCODE.Text == String.Empty)
                    {
                        using (MySqlCommand CM = new MySqlCommand("UPDATE item SET barcode=@barcode WHERE item_id=@item_id", CONNECTION.CON))
                        {
                            CM.Parameters.Clear();
                            CM.Parameters.AddWithValue("@item_id", LBL_ITEM_ID.Text);
                            CM.Parameters.AddWithValue("@barcode", LBL_ITEM_ID.Text);
                            CM.ExecuteNonQuery();
                        }
                    }
                    else
                    {
                        using (MySqlCommand C = new MySqlCommand("UPDATE item SET barcode=@barcode WHERE item_id=@item_id", CONNECTION.CON))
                        {
                            C.Parameters.Clear();
                            C.Parameters.AddWithValue("@item_id", LBL_ITEM_ID.Text);
                            C.Parameters.AddWithValue("@barcode", TXT_BARCODE.Text);
                            C.ExecuteNonQuery();
                        }
                    }

                    MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "ITEM ADDED SUCCESFULLY!", MessageAlertImage.Success());
                    mdg.ShowDialog();
                }
                else
                {
                    MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "ITEM ADDED FAILED!", MessageAlertImage.Alert());
                    mdg.ShowDialog();
                }
            }
            //}
            //catch (Exception ex)
            //{
            //    MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), ex.Message, MessageAlertImage.Error());
            //    mdg.ShowDialog();
            //}
            //finally
            //{
            //    CONNECTION.close_connection();
            //}
        }
        private void BTN_SAVE_Click(object sender, EventArgs e)
        {
            string result = UPDATE_ORDER();

            if (result == "done")
            {
                MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "ORDER UPDATED SUCCESSFULLY", MessageAlertImage.Success());
                mdg.ShowDialog();
            }
        }
Ejemplo n.º 9
0
        private void aCTIVEDEACTIVEToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string result = UPDATE_MEAL_PLAN_STATUS();

            if (result == "done")
            {
                MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "MEAL PLAN STATUS UPDATED SUCCESSFULLY!", MessageAlertImage.Success());
                mdg.ShowDialog();
                LOAD_MEAP_PLAN_lIST();
            }
        }
Ejemplo n.º 10
0
 private void BTN_SERVED_Click(object sender, EventArgs e)
 {
     if (DGV_KOT.SelectedRows.Count > 0)
     {
         string result = MARK_ORDER_AS_SERVED();
         if (result == "done")
         {
             MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "ORDER STATUS UPDATED AS SERVED", MessageAlertImage.Success());
             mdg.ShowDialog();
         }
     }
 }
Ejemplo n.º 11
0
        private void shapedButton1_Click(object sender, EventArgs e)
        {
            string result = ADD_FLOOR();

            if (result == "done")
            {
                MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "FLOOR ADDED SUCCESSFULLY!", MessageAlertImage.Success());
                mdg.ShowDialog();
                TXT_FLOOR_NAME.Clear();
                TXT_FLOOR_NAME.Focus();
                LOAD_FLOOR_LIST();
            }
        }
Ejemplo n.º 12
0
 private void BTN_SAVE_Click(object sender, EventArgs e)
 {
     if (TXT_ROOM_NO.Text == string.Empty)
     {
         TXT_ROOM_NO.Focus();
         MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "PLEASE ENTER ROOM NO/NAME", MessageAlertImage.Warning());
         mdg.ShowDialog();
     }
     else if (CMB_ROOM_PKG.SelectedIndex < 0)
     {
         CMB_ROOM_PKG.Focus();
         MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "PLEASE SELECT ROOM PACKAGE", MessageAlertImage.Warning());
         mdg.ShowDialog();
     }
     else if (CMB_ROOM_TYPE.SelectedIndex < 0)
     {
         CMB_ROOM_TYPE.Focus();
         MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "PLEASE SELECT ROOM TYPE", MessageAlertImage.Warning());
         mdg.ShowDialog();
     }
     else if (CMB_FLOOR.SelectedIndex < 0)
     {
         CMB_FLOOR.Focus();
         MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "PLEASE SELECT THE FLOOR", MessageAlertImage.Warning());
         mdg.ShowDialog();
     }
     else
     {
         if (BTN_SAVE.Text == "SAVE")
         {
             string result = SAVE_ROOM();
             if (result == "done")
             {
                 MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "ROOM ADDED SUCCESSFULLY!", MessageAlertImage.Success());
                 mdg.ShowDialog();
                 DisableControls();
             }
         }
         else if (BTN_SAVE.Text == "UPDATE")
         {
             string result = UPDATE_ROOM_DETAILS();
             if (result == "done")
             {
                 MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "ROOM DETAILS UPDATED SUCCESSFULLY!", MessageAlertImage.Success());
                 mdg.ShowDialog();
             }
         }
         LOAD_ROOM_lIST();
     }
 }
 private void BTN_NEW_Click(object sender, EventArgs e)
 {
     if (TXT_TOTAL_TAX.Text.Length > 0)
     {
         HYFLEX_HMS.Properties.Settings.Default.tax_percentage = Convert.ToDouble(TXT_TOTAL_TAX.Text);
         HYFLEX_HMS.Properties.Settings.Default.Save();
         MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "NEW RATE SAVED!", MessageAlertImage.Success());
         mdg.ShowDialog();
     }
     else
     {
         MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "PLEASE SET VAT VALUES", MessageAlertImage.Success());
         mdg.ShowDialog();
     }
 }
Ejemplo n.º 14
0
 private void SAVE_ROOM_PACKAGE()
 {
     try
     {
         CONNECTION.open_connection();
         using (MySqlCommand cmd = new MySqlCommand("INSERT INTO room_packages(package_name,description,`condition`,room_package_price,package_color) VALUES(@package_name,@description,@condition,@room_package_price,@package_color)", CONNECTION.CON))
         {
             cmd.Parameters.Clear();
             cmd.Parameters.AddWithValue("@package_name", TXT_PKG_NAME.Text);
             cmd.Parameters.AddWithValue("@description", TXT_DESCRIPTION.Text);
             cmd.Parameters.AddWithValue("@condition", CMB_ROOM_TYPE.Text);
             cmd.Parameters.AddWithValue("@room_package_price", Convert.ToDouble(TXT_PKG_RATE.Text));
             cmd.Parameters.AddWithValue("@package_color", LBL_COLOR.Text);
             if (cmd.ExecuteNonQuery() > 0)
             {
                 int room_pkg_no = 0;
                 using (MySqlDataAdapter adp = new MySqlDataAdapter("SELECT MAX(room_package_id) FROM room_packages", CONNECTION.CON))
                 {
                     DataTable tbl = new DataTable();
                     adp.Fill(tbl);
                     if (tbl.Rows.Count > 0)
                     {
                         room_pkg_no = tbl.Rows[0].Field <Int32>(0);
                     }
                 }
                 LBL_PKG_ID.Text = room_pkg_no.ToString();
                 MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "PACKAGE ADDED SUCCESSFULLY!", MessageAlertImage.Success());
                 mdg.ShowDialog();
                 DisableControls();
             }
             else
             {
                 MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "FAILED TO ADD ROOM PACKAGE!", MessageAlertImage.Alert());
                 mdg.ShowDialog();
             }
         }
     }
     catch (Exception ex)
     {
         MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), ex.Message, MessageAlertImage.Error());
         mdg.ShowDialog();
     }
     finally
     {
         CONNECTION.close_connection();
     }
 }
Ejemplo n.º 15
0
 private void BTN_ADD_SERVICE_Click(object sender, EventArgs e)
 {
     CONNECTION.open_connection();
     try
     {
         if (CMB_SERVICES.SelectedIndex == -1)
         {
             MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "Select a Service", MessageAlertImage.Warning());
             mdg.ShowDialog();
             CMB_SERVICES.DroppedDown = true;
         }
         else if (TXT_QTY.Text == "0.00")
         {
             MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "Enter Quantity", MessageAlertImage.Warning());
             mdg.ShowDialog();
             TXT_QTY.Focus();
         }
         else
         {
             using (MySqlCommand addservice = new MySqlCommand("INSERT INTO additional_service(reservation_id,additional_serivice_id,additional_serivice_qty,additional_serivice_price,room_id) VALUES(@rid,@serviceid,@qty,@price,@roomid)", CONNECTION.CON))
             {
                 addservice.Parameters.AddWithValue("@rid", Reservation_id);
                 addservice.Parameters.AddWithValue("@serviceid", CMB_SERVICES.SelectedValue);
                 addservice.Parameters.AddWithValue("@qty", TXT_QTY.Text);
                 addservice.Parameters.AddWithValue("@price", Convert.ToDouble(TXT_SUBTOTAL.Text));
                 addservice.Parameters.AddWithValue("@roomid", Room_id);
                 int n1 = addservice.ExecuteNonQuery();
                 if (n1 == 1)
                 {
                     DISPLAY_ADDED_SERVICES(Reservation_id, Room_id);
                     MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "Service Added Successfully", MessageAlertImage.Success());
                     mdg.ShowDialog();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), ex.Message, MessageAlertImage.Error());
         mdg.ShowDialog();
     }
     finally
     {
         CONNECTION.close_connection();
     }
 }
Ejemplo n.º 16
0
 private void AddAgent()
 {
     CONNECTION.open_connection();
     try
     {
         using (MySqlCommand addagent = new MySqlCommand("INSERT INTO agent(agent_name,address,contact_no,company_name,company_contact_no,commison_rate,description,added_by,added_date,added_time,agent_status) VALUES(@name,@address,@contact_no,@company_name,@copmany_contact_no,@commison_rate,@description,@added_by,@added_date,@added_time,@agent_status)", CONNECTION.CON))
         {
             addagent.Parameters.AddWithValue("@name", TXT_AGENT_NAME.Text);
             addagent.Parameters.AddWithValue("@address", TXT_ADDRESS.Text);
             addagent.Parameters.AddWithValue("@contact_no", TXT_CONTACT_NO.Text);
             addagent.Parameters.AddWithValue("@company_name", TXT_COMPANY_NAME.Text);
             addagent.Parameters.AddWithValue("@copmany_contact_no", TXT_COMPANY_CONTACT_NO.Text);
             addagent.Parameters.AddWithValue("@commison_rate", TXT_COM_RATE.Text);
             addagent.Parameters.AddWithValue("@description", TXT_DESCRIPTION.Text);
             addagent.Parameters.AddWithValue("@added_by", CLS_CURRENT_LOGGER.LOGGED_IN_USERID);
             addagent.Parameters.AddWithValue("@added_date", DateTime.Now.ToString("yyyy-MM-dd"));
             addagent.Parameters.AddWithValue("@added_time", DateTime.Now.ToString("HH:mm:ss"));
             addagent.Parameters.AddWithValue("@agent_status", "1");
             int n1 = addagent.ExecuteNonQuery();
             if (n1 == 1)
             {
                 MySqlDataAdapter da        = new MySqlDataAdapter("SELECT LAST_INSERT_ID()", CONNECTION.CON);
                 DataTable        getlastid = new DataTable();
                 da.Fill(getlastid);
                 if (getlastid.Rows.Count > 0)
                 {
                     LBL_AGENT_ID.Text = getlastid.Rows[0][0].ToString();
                 }
                 LoadGrid();
                 MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "Saved Successfully", MessageAlertImage.Success());
                 mdg.ShowDialog();
                 EnableControls(false);
             }
         }
     }
     catch (Exception ex)
     {
         MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), ex.Message, MessageAlertImage.Error());
         mdg.ShowDialog();
     }
     finally
     {
         CONNECTION.close_connection();
     }
 }
Ejemplo n.º 17
0
 private void BTN_OK_Click_1(object sender, EventArgs e)
 {
     if (TXT_ITEM_NAME.Text == string.Empty)
     {
         MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "PLEASE ENTER ITEM NAME", MessageAlertImage.Warning());
         mdg.ShowDialog();
         TXT_ITEM_NAME.Focus();
     }
     else
     {
         string result = ADD_OPEN_FOOD();
         if (result == "done")
         {
             MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "OPEN FOOD ADDED SUCCESSFULLY", MessageAlertImage.Success());
             mdg.ShowDialog();
             this.Close();
         }
     }
 }
 private void SAVE_GUEST()
 {
     try
     {
         CONNECTION.open_connection();
         using (MySqlCommand da = new MySqlCommand("INSERT INTO guest ( guest_id, id_no, first_name, last_name, mobile_no, gender, passport_no, address, email, country_id ) VALUES ( @guest_id, @id_no, @first_name, @last_name, @mobile_no, @gender, @passport_no, @address, @email, @country_id )", CONNECTION.CON))
         {
             da.Parameters.Clear();
             da.Parameters.AddWithValue("@guest_id", CLS_GENERATE_ID.GEN_NEXT_GUEST_NO());
             da.Parameters.AddWithValue("@id_no", TXT_ID_NUMBER.Text);
             da.Parameters.AddWithValue("@first_name", TXT_FNAME.Text);
             da.Parameters.AddWithValue("@last_name", TXT_LNAME.Text);
             da.Parameters.AddWithValue("@mobile_no", TXT_MOBILENO.Text);
             da.Parameters.AddWithValue("@gender", CMB_GENDER.Text);
             da.Parameters.AddWithValue("@passport_no", TXT_PASSPORT.Text);
             da.Parameters.AddWithValue("@address", TXT_ADDRESS.Text);
             da.Parameters.AddWithValue("@email", TXT_EMAIL.Text);
             da.Parameters.AddWithValue("@country_id", CMB_COUNTRY.SelectedValue);
             if (da.ExecuteNonQuery() > 0)
             {
                 LBL_GUEST.Text = CLS_METHODS.GET_MAX_STRING_ID("SELECT MAX(guest_id) FROM guest");
                 MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "GUEST ADDED SUCCESFULLY!", MessageAlertImage.Success());
                 mdg.ShowDialog();
             }
             else
             {
                 MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "GUEST ADDED FAILED!", MessageAlertImage.Alert());
                 mdg.ShowDialog();
             }
         }
     }
     catch (Exception ex)
     {
         MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), ex.Message, MessageAlertImage.Error());
         mdg.ShowDialog();
     }
     finally
     {
         CONNECTION.close_connection();
     }
 }
 private void BTN_CANCEL_ORDER_Click(object sender, EventArgs e)
 {
     if (DGV_KOT.SelectedRows.Count > 0)
     {
         DialogResult dialogResult = MessageBox.Show("Are you sure, Do you want to cancel the order ?", "Cancel Order", MessageBoxButtons.YesNo);
         if (dialogResult == DialogResult.Yes)
         {
             string result = CANCEL_ORDER(DGV_KOT.SelectedRows[0].Cells["Column1"].Value.ToString());
             if (result == "done")
             {
                 MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "ORDER CANCELED SUCCESSFULLY", MessageAlertImage.Success());
                 mdg.ShowDialog();
             }
         }
     }
     else
     {
         MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "PLEASE SELECT ORDER TO CANCEL", MessageAlertImage.Warning());
         mdg.ShowDialog();
     }
 }
 private void BTN_SAVE_Click(object sender, EventArgs e)
 {
     if (CMB_TRANS_TYPE.SelectedIndex < 0)
     {
         MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "PLEASE SELECT TRANSACTION CATEGORY TYPE!", MessageAlertImage.Warning());
         mdg.ShowDialog();
         CMB_TRANS_TYPE.Focus();
     }
     else if (TXT_TRANS_CAT.Text == string.Empty)
     {
         MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "PLEASE ENTER TRANSACTION CATEGORY NAME!", MessageAlertImage.Warning());
         mdg.ShowDialog();
         CMB_TRANS_TYPE.Focus();
     }
     else
     {
         if (BTN_SAVE.Text == "SAVE")
         {
             string result = SAVE_TRANSACTION_CATEGORY();
             if (result == "done")
             {
                 MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "TRANSACTION CATEGORY SAVED SUCCESSFULLY", MessageAlertImage.Success());
                 mdg.ShowDialog();
                 CLEAR();
                 LOAD_OTHER_CATEGORY_LIST();
             }
         }
         else
         {
             string result = UPDATE_TRANSACTION_CATEGORY();
             if (result == "done")
             {
                 MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "TRANSACTION CATEGORY UPDATED SUCCESSFULLY", MessageAlertImage.Success());
                 mdg.ShowDialog();
                 LOAD_OTHER_CATEGORY_LIST();
             }
         }
     }
 }
 private void UPDATE_SUPPLIERS_DATA()
 {
     try
     {
         CONNECTION.open_connection();
         using (MySqlCommand da = new MySqlCommand("UPDATE supplier SET supplier_id = @supplier_id, supplier_name = @supplier_name, company_name = @company_name, address = @address, contact1 = @contact1, contact2 = @contact2, note = @note WHERE supplier_id = @supplier_id", CONNECTION.CON))
         {
             da.Parameters.Clear();
             da.Parameters.AddWithValue("@supplier_id", LBL_SUPPLIER_ID.Text);
             da.Parameters.AddWithValue("@supplier_name", TXT_SUPPLIER_NAME.Text);
             da.Parameters.AddWithValue("@company_name", TXT_COMPANY_NAME.Text);
             da.Parameters.AddWithValue("@address", TXT_ADDRESS.Text);
             da.Parameters.AddWithValue("@contact1", TXT_CONTACT_01.Text);
             da.Parameters.AddWithValue("@contact2", TXT_CONTACT_02.Text);
             da.Parameters.AddWithValue("@note", TXT_NOTE.Text);
             if (da.ExecuteNonQuery() > 0)
             {
                 MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "SUPPLIER DETAILS UPDATED SUCCESFULLY!", MessageAlertImage.Success());
                 mdg.ShowDialog();
                 clearAll();
             }
             else
             {
                 MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "SUPPLIER DETAILS UPDATE FAILED!", MessageAlertImage.Alert());
                 mdg.ShowDialog();
             }
         }
     }
     catch (Exception ex)
     {
         MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), ex.Message, MessageAlertImage.Error());
         mdg.ShowDialog();
     }
     finally
     {
         CONNECTION.close_connection();
     }
 }
 private void SAVE_SUPPLIER()
 {
     try
     {
         CONNECTION.open_connection();
         using (MySqlCommand da = new MySqlCommand("INSERT INTO supplier (supplier_name, company_name, address, contact1, contact2, note ) VALUES ( @supplier_name, @company_name, @address, @contact1, @contact2, @note )", CONNECTION.CON))
         {
             da.Parameters.Clear();
             da.Parameters.AddWithValue("@supplier_name", TXT_SUPPLIER_NAME.Text);
             da.Parameters.AddWithValue("@company_name", TXT_COMPANY_NAME.Text);
             da.Parameters.AddWithValue("@address", TXT_ADDRESS.Text);
             da.Parameters.AddWithValue("@contact1", TXT_CONTACT_01.Text);
             da.Parameters.AddWithValue("@contact2", TXT_CONTACT_02.Text);
             da.Parameters.AddWithValue("@note", TXT_NOTE.Text);
             if (da.ExecuteNonQuery() > 0)
             {
                 LBL_SUPPLIER_ID.Text = GETMAXID();
                 MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "SUPPLIER ADDED SUCCESFULLY!", MessageAlertImage.Success());
                 mdg.ShowDialog();
             }
             else
             {
                 MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "SUPPLIER ADDED FAILED!", MessageAlertImage.Alert());
                 mdg.ShowDialog();
             }
         }
     }
     catch (Exception ex)
     {
         MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), ex.Message, MessageAlertImage.Error());
         mdg.ShowDialog();
     }
     finally
     {
         CONNECTION.close_connection();
     }
 }
        private void BTN_REMOVE_Click(object sender, EventArgs e)
        {
            if (DGV_MENU.SelectedRows.Count > 0)
            {
                MySqlCommand     cmd     = CONNECTION.CON.CreateCommand();
                MySqlTransaction myTrans = null;
                try
                {
                    CONNECTION.open_connection();
                    cmd.Connection  = CONNECTION.CON;
                    cmd.Transaction = myTrans;
                    myTrans         = CONNECTION.CON.BeginTransaction();

                    foreach (DataGridViewRow dr in DGV_MENU.SelectedRows)
                    {
                        cmd.CommandText = "DELETE FROM daily_menu WHERE id=@id";
                        cmd.Parameters.Clear();
                        cmd.Parameters.AddWithValue("@id", dr.Cells[0].Value);
                        cmd.ExecuteNonQuery();
                    }
                    myTrans.Commit();
                    MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "SELECTED ITEMS REMOVED SUCCESSFULLY", MessageAlertImage.Success());
                    mdg.ShowDialog();
                    LOAD_DAY_MENU(DTP_MENU_DATE.Value.ToString("yyyy-MM-dd"));
                }
                catch (Exception EX)
                {
                    myTrans.Rollback();
                    MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), EX.Message, MessageAlertImage.Error());
                    mdg.ShowDialog();
                }
                finally
                {
                    CONNECTION.close_connection();
                }
            }
        }
Ejemplo n.º 24
0
 private void UpdateAgent()
 {
     CONNECTION.open_connection();
     try
     {
         using (MySqlCommand updateagent = new MySqlCommand("UPDATE agent SET agent_name=@name,address=@address,contact_no=@contact_no,company_name=@company_name,company_contact_no=@company_contact_no,commison_rate=@commison_rate,description=@description WHERE agent_id=@id", CONNECTION.CON))
         {
             updateagent.Parameters.AddWithValue("@id", LBL_AGENT_ID.Text);
             updateagent.Parameters.AddWithValue("@name", TXT_AGENT_NAME.Text);
             updateagent.Parameters.AddWithValue("@address", TXT_ADDRESS.Text);
             updateagent.Parameters.AddWithValue("@contact_no", TXT_CONTACT_NO.Text);
             updateagent.Parameters.AddWithValue("@company_name", TXT_COMPANY_NAME.Text);
             updateagent.Parameters.AddWithValue("@company_contact_no", TXT_COMPANY_CONTACT_NO.Text);
             updateagent.Parameters.AddWithValue("@commison_rate", TXT_COM_RATE.Text);
             updateagent.Parameters.AddWithValue("@description", TXT_DESCRIPTION.Text);
             int n1 = updateagent.ExecuteNonQuery();
             if (n1 == 1)
             {
                 LoadGrid();
                 ClearAll();
                 MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "Updated Successfully", MessageAlertImage.Success());
                 mdg.ShowDialog();
                 BTN_SAVE.Text = "SAVE";
             }
         }
     }
     catch (Exception ex)
     {
         MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), ex.Message, MessageAlertImage.Error());
         mdg.ShowDialog();
     }
     finally
     {
         CONNECTION.close_connection();
     }
 }
Ejemplo n.º 25
0
 private void UPDATE_ITEMS()
 {
     try
     {
         CONNECTION.open_connection();
         using (MySqlCommand da = new MySqlCommand("UPDATE item SET barcode=@barcode,item_category=@item_category,item_name=@item_name,item_type_id=@item_type_id WHERE item_id=@item_id", CONNECTION.CON))
         {
             da.Parameters.Clear();
             da.Parameters.AddWithValue("@barcode", TXT_BARCODE.Text);
             da.Parameters.AddWithValue("@item_category", CMB_CATEGORY.SelectedValue);
             da.Parameters.AddWithValue("@item_name", TXT_ITEMNAME.Text);
             da.Parameters.AddWithValue("@item_id", LBL_ITEM_ID.Text);
             da.Parameters.AddWithValue("@item_type_id", CMB_ITEM_TYPE.SelectedValue);
             da.Parameters.AddWithValue("@item_status", "ENABLE");
             if (da.ExecuteNonQuery() > 0)
             {
                 MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "ITEM UPDATED SUCCESFULLY!", MessageAlertImage.Success());
                 mdg.ShowDialog();
             }
             else
             {
                 MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "ITEM UPDATE FAILED!", MessageAlertImage.Alert());
                 mdg.ShowDialog();
             }
         }
     }
     catch (Exception ex)
     {
         MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), ex.Message, MessageAlertImage.Error());
         mdg.ShowDialog();
     }
     finally
     {
         CONNECTION.close_connection();
     }
 }
 private void UPDATE_RATE()
 {
     try
     {
         double TOTAL = 0;
         CONNECTION.open_connection();
         using (MySqlCommand DA = new MySqlCommand("UPDATE tax_details SET precentage=@precentage WHERE tax_type_id=@tax_type_id", CONNECTION.CON))
         {
             DA.Parameters.Clear();
             DA.Parameters.AddWithValue("@precentage", Convert.ToDouble(DGV_TAV.SelectedRows[0].Cells[2].Value));
             DA.Parameters.AddWithValue("@tax_type_id", Convert.ToInt16(DGV_TAV.SelectedRows[0].Cells[0].Value));
             if (DA.ExecuteNonQuery() > 0)
             {
                 MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "NEW RATE UPDATED!", MessageAlertImage.Success());
                 mdg.ShowDialog();
             }
         }
     }
     catch (Exception EX)
     {
         MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), EX.Message, MessageAlertImage.Error());
         mdg.ShowDialog();
     }
 }
        private void SAVE_RESERVATION()
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                LOCK_CONTROLLERS();
                CONNECTION.open_connection();
                myTrans         = CONNECTION.CON.BeginTransaction();
                cmd.Connection  = CONNECTION.CON;
                cmd.Transaction = myTrans;
                string GUESTID        = string.Empty;
                string RES            = CHECK_GUEST_DATA();
                string RESERVATION_ID = CLS_GENERATE_ID.GEN_NEXT_RESERVATION_NO();
                if (RES != "N")
                {
                    GUESTID = RES;
                }
                else
                {
                    GUESTID         = CLS_GENERATE_ID.GEN_NEXT_GUEST_NO();
                    cmd.CommandText = "INSERT INTO guest ( guest_id, id_no, first_name, last_name, mobile_no, gender, passport_no, address, email, country_id ) VALUES ( @guest_id, @id_no, @first_name, @last_name, @mobile_no, @gender, @passport_no, @address, @email, @country_id )";
                    cmd.Parameters.Clear();
                    cmd.Parameters.AddWithValue("@guest_id", GUESTID);
                    cmd.Parameters.AddWithValue("@id_no", TXT_NIC_NO.Text);
                    cmd.Parameters.AddWithValue("@first_name", TXT_F_NAME.Text);
                    cmd.Parameters.AddWithValue("@last_name", TXT_L_NAME.Text);
                    cmd.Parameters.AddWithValue("@mobile_no", TXT_TEL.Text);
                    cmd.Parameters.AddWithValue("@gender", "MALE");
                    cmd.Parameters.AddWithValue("@passport_no", "N/A");
                    cmd.Parameters.AddWithValue("@address", "N/A");
                    cmd.Parameters.AddWithValue("@email", TXT_EMAIL.Text);
                    cmd.Parameters.AddWithValue("@country_id", 199);
                    cmd.ExecuteNonQuery();
                }

                TEMP_GUEST_ID = CLS_METHODS.GET_MAX_STRING_ID("SELECT MAX(guest_id) FROM guest");

                cmd.CommandText = "INSERT INTO reservation ( reservation_id, guest_id, no_of_adult, no_of_child, arrival_date, depature_Date, no_of_nights, reserved_by, agent_id, additional_note,added_date,added_time,added_by,no_of_rooms,tax_status ) VALUES ( @reservation_id, @guest_id, @no_of_adult, @no_of_child, @arrival_date, @depature_Date, @no_of_nights, @reserved_by, @agent_id, @additional_note,@added_date,CURTIME(),@added_by,@no_of_rooms,@tax_status )";
                cmd.Parameters.Clear();
                cmd.Parameters.AddWithValue("@reservation_id", RESERVATION_ID);
                cmd.Parameters.AddWithValue("@guest_id", GUESTID);
                cmd.Parameters.AddWithValue("@no_of_adult", Convert.ToInt16(TXT_ADULT.Text));
                cmd.Parameters.AddWithValue("@no_of_child", Convert.ToInt16(TXT_CHILD.Text));
                cmd.Parameters.AddWithValue("@arrival_date", DTP_ARRIVAL_DATE.Value.ToShortDateString());
                cmd.Parameters.AddWithValue("@depature_Date", DTP_DEPATURE_DATE.Value.ToShortDateString());
                cmd.Parameters.AddWithValue("@no_of_nights", (DTP_DEPATURE_DATE.Value - DTP_ARRIVAL_DATE.Value).TotalDays);
                cmd.Parameters.AddWithValue("@reserved_by", CMB_RESERVE_BY.Text);
                cmd.Parameters.AddWithValue("@no_of_rooms", Convert.ToInt16(TXT_NO_OF_ROOMS.Text));
                if (CMB_TAX.SelectedIndex == 0)
                {
                    cmd.Parameters.AddWithValue("@tax_status", "1");
                }
                else
                {
                    cmd.Parameters.AddWithValue("@tax_status", "0");
                }

                if (CMB_RESERVE_BY.SelectedIndex == 3)
                {
                    cmd.Parameters.AddWithValue("@agent_id", CMB_AGENT.SelectedValue);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@agent_id", "0");
                }

                cmd.Parameters.AddWithValue("@additional_note", TXT_NOTE.Text);
                cmd.Parameters.AddWithValue("@added_date", DateTime.Now.ToShortDateString());
                cmd.Parameters.AddWithValue("@added_by", CLS_CURRENT_LOGGER.LOGGED_IN_USERID);
                cmd.ExecuteNonQuery();

                foreach (ListViewItem lvi in LST_SELECTED_ROOM.Items)
                {
                    cmd.CommandText = "INSERT INTO recerved_rooms ( reservation_no, room_id, room_charge ) VALUES ( @reservation_no, @room_id, @room_charge)";
                    cmd.Parameters.Clear();
                    cmd.Parameters.AddWithValue("@reservation_no", RESERVATION_ID);
                    cmd.Parameters.AddWithValue("@room_id", Convert.ToInt32(lvi.SubItems[0].Text));
                    cmd.Parameters.AddWithValue("@room_charge", Convert.ToDouble(lvi.SubItems[3].Text));
                    cmd.ExecuteNonQuery();

                    cmd.CommandText = "UPDATE room SET current_status=@current_status WHERE room_id=@room_id";
                    cmd.Parameters.Clear();
                    cmd.Parameters.AddWithValue("@room_id", Convert.ToInt32(lvi.SubItems[0].Text));
                    cmd.Parameters.AddWithValue("@current_status", "RESERVED");
                    cmd.ExecuteNonQuery();
                }

                myTrans.Commit();


                LBL_RESERVATION_ID.Text = RESERVATION_ID;
                MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "RESERVATION ADDED SUCCESFULLY" + Environment.NewLine + Environment.NewLine + "RESERVATION NO IS : " + RESERVATION_ID, MessageAlertImage.Success());
                mdg.ShowDialog();
                BTN_NEW.Focus();
            }
            catch (Exception EX)
            {
                Cursor.Current = Cursors.Default;
                UNLOCK_CONTROLLERS();
                myTrans.Rollback();
                MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), EX.Message, MessageAlertImage.Error());
                mdg.ShowDialog();
            }
            finally
            {
                UNLOCK_CONTROLLERS();
                Cursor.Current = Cursors.Default;
                CONNECTION.close_connection();
            }
        }
Ejemplo n.º 28
0
        private void SAVEGRN()
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                CONNECTION.open_connection();
                myTrans         = CONNECTION.CON.BeginTransaction();
                cmd.Connection  = CONNECTION.CON;
                cmd.Transaction = myTrans;
                String GRN_NO      = CLS_GENERATE_ID.GEN_NEXT_GRN_NO();
                double total_price = Convert.ToDouble(LBL_TOT_GRN.Text);
                double credit      = Convert.ToDouble(TXT_CREDIT.Text);
                double cash        = Convert.ToDouble(TXT_CASH.Text);
                double cheque      = Convert.ToDouble(TXT_CHEQUE.Text);
                double card        = Convert.ToDouble(TXT_CARD.Text);

                string type = string.Empty;
                if (cash > 0 && cheque <= 0 && card <= 0)
                {
                    type = "CASH";
                }
                else if (cash <= 0 && cheque > 0 && card <= 0)
                {
                    type = "CHEQUE";
                }
                else if (cash <= 0 && cheque <= 0 && card > 0)
                {
                    type = "CARD";
                }
                else if (cash > 0 && cheque > 0 && card <= 0)
                {
                    type = "CASH/CHEQUE";
                }
                else if (cash > 0 && cheque > 0 && card > 0)
                {
                    type = "CARD/CHEQUE/CARD";
                }
                else if (cash <= 0 && cheque > 0 && card > 0)
                {
                    type = "CHEQUE/CARD";
                }
                else if (cash > 0 && cheque <= 0 && card > 0)
                {
                    type = "CASH/CARD";
                }
                else
                {
                    type = "CREDIT";
                }

                LBL_GRN_NO.Text = GRN_NO;
                cmd.CommandText = "INSERT INTO grn ( grn_no, payment_type, supplier_id, grn_total, added_by, added_date, added_time ) VALUES ( @grn_no, @payment_type, @supplier_id, @grn_total, @added_by, @added_date, @added_time )";
                cmd.Parameters.Clear();
                cmd.Parameters.AddWithValue("@grn_no", GRN_NO);
                cmd.Parameters.AddWithValue("@payment_type", type);
                cmd.Parameters.AddWithValue("@supplier_id", CMB_SUPPLIER.SelectedValue);
                cmd.Parameters.AddWithValue("@grn_total", Convert.ToDouble(LBL_TOT_GRN.Text));
                cmd.Parameters.AddWithValue("@added_by", CLS_CURRENT_LOGGER.LOGGED_IN_USERID);
                cmd.Parameters.AddWithValue("@added_date", DTP_GRN_DATE.Value.ToString("yyyy-MM-dd"));
                cmd.Parameters.AddWithValue("@added_time", DTP_GRN_DATE.Value.ToString("HH:mm:ss"));
                cmd.ExecuteNonQuery();

                foreach (DataGridViewRow dgvr in DGV_ITEMS_LIST.Rows)
                {
                    cmd.CommandText = "INSERT INTO stock_items ( item_code, qty, cost_price, sales_price, grn_no ) VALUES (@item_code, @qty, @cost_price, @sales_price, @grn_no)";
                    cmd.Parameters.Clear();
                    cmd.Parameters.AddWithValue("@item_code", Convert.ToInt32(dgvr.Cells[0].Value));
                    cmd.Parameters.AddWithValue("@qty", Convert.ToDouble(dgvr.Cells[3].Value.ToString()));
                    cmd.Parameters.AddWithValue("@cost_price", Convert.ToDouble(dgvr.Cells[4].Value.ToString()));
                    cmd.Parameters.AddWithValue("@sales_price", Convert.ToDouble(dgvr.Cells[5].Value.ToString()));
                    cmd.Parameters.AddWithValue("@grn_no", GRN_NO);
                    cmd.ExecuteNonQuery();

                    using (MySqlDataAdapter adp = new MySqlDataAdapter("SELECT stock_id,qty FROM stock WHERE item_code=@item_code  AND cost_price=@cost_price AND sales_price=@sales_price", CONNECTION.CON))
                    {
                        adp.SelectCommand.Parameters.Clear();
                        adp.SelectCommand.Parameters.AddWithValue("@item_code", Convert.ToInt32(dgvr.Cells[0].Value.ToString()));
                        adp.SelectCommand.Parameters.AddWithValue("@cost_price", Convert.ToDouble(dgvr.Cells[4].Value.ToString()));
                        adp.SelectCommand.Parameters.AddWithValue("@sales_price", Convert.ToDouble(dgvr.Cells[5].Value.ToString()));
                        DataTable dtb = new DataTable();
                        adp.Fill(dtb);
                        if (dtb.Rows.Count > 0)
                        {
                            cmd.CommandText = "UPDATE stock SET qty=qty+@qty WHERE stock_id=@stock_id";
                            cmd.Parameters.Clear();
                            cmd.Parameters.AddWithValue("@stock_id", Convert.ToInt32(dtb.Rows[0].Field <int>(0)));
                            double total_qty = Convert.ToDouble(dtb.Rows[0].Field <double>(1)) + Convert.ToDouble(dgvr.Cells[3].Value.ToString());
                            cmd.Parameters.AddWithValue("@qty", total_qty);
                            cmd.ExecuteNonQuery();
                        }
                        else
                        {
                            cmd.CommandText = "INSERT INTO stock( item_code, qty, cost_price, sales_price ) VALUES ( @item_code, @qty, @cost_price, @sales_price)";
                            cmd.Parameters.Clear();
                            cmd.Parameters.AddWithValue("@item_code", Convert.ToInt32(dgvr.Cells[0].Value.ToString()));
                            cmd.Parameters.AddWithValue("@qty", Convert.ToDouble(dgvr.Cells[3].Value.ToString()));
                            cmd.Parameters.AddWithValue("@cost_price", Convert.ToDouble(dgvr.Cells[4].Value.ToString()));
                            cmd.Parameters.AddWithValue("@sales_price", Convert.ToDouble(dgvr.Cells[5].Value.ToString()));
                            cmd.ExecuteNonQuery();
                        }
                    }
                }

                if (credit > 0)
                {
                    cmd.CommandText = "INSERT INTO supplier_account ( account_no, supplier_id, grn_no, grn_total, paid, due,added_date,added_time,added_by ) VALUES ( @account_no, @supplier_id, @grn_no, @grn_total, @paid, @due ,@added_date,@added_time,@added_by)";
                    cmd.Parameters.Clear();
                    cmd.Parameters.AddWithValue("@account_no", CLS_GENERATE_ID.GEN_NEXT_ACC_NO());
                    cmd.Parameters.AddWithValue("@supplier_id", CMB_SUPPLIER.SelectedValue);
                    cmd.Parameters.AddWithValue("@grn_no", GRN_NO);
                    cmd.Parameters.AddWithValue("@grn_total", total_price);
                    cmd.Parameters.AddWithValue("@paid", cash);
                    cmd.Parameters.AddWithValue("@due", credit);
                    cmd.Parameters.AddWithValue("@added_date", DTP_GRN_DATE.Value.ToString("yyyy-MM-dd"));
                    cmd.Parameters.AddWithValue("@added_time", DTP_GRN_DATE.Value.ToString("HH:mm:ss"));
                    cmd.Parameters.AddWithValue("@added_by", CLS_CURRENT_LOGGER.LOGGED_IN_USERID);
                    cmd.ExecuteNonQuery();
                }

                if (cheque > 0)
                {
                    cmd.CommandText = "INSERT INTO issue_cheque (grn_no, amount, cheque_date, issued_date, supplier_id, bank_id, cheque_no, issued_time, issued_by ) VALUES ( @grn_no, @amount, @cheque_date, @issued_date, @supplier_id, @bank_id, @cheque_no, @issued_time, @issued_by)";
                    cmd.Parameters.Clear();
                    cmd.Parameters.AddWithValue("@grn_no", GRN_NO);
                    cmd.Parameters.AddWithValue("@amount", cheque);
                    cmd.Parameters.AddWithValue("@cheque_date", DTP_CHEQUE_DATE.Value.ToString("yyyy-MM-dd"));
                    cmd.Parameters.AddWithValue("@issued_date", DTP_GRN_DATE.Value.ToString("yyyy-MM-dd"));
                    cmd.Parameters.AddWithValue("@supplier_id", CMB_SUPPLIER.SelectedValue);
                    cmd.Parameters.AddWithValue("@bank_id", CMB_CHEQUE_BANK.SelectedValue);
                    cmd.Parameters.AddWithValue("@cheque_no", TXT_CHEQUE_NO.Text);
                    cmd.Parameters.AddWithValue("@issued_time", DateTime.Now.ToString("HH:mm:ss"));
                    cmd.Parameters.AddWithValue("@issued_by", CLS_CURRENT_LOGGER.LOGGED_IN_USERID);
                    cmd.ExecuteNonQuery();
                }


                if (cash > 0)
                {
                    cmd.CommandText = "INSERT INTO account(income_type, payment_type, payment, added_date, added_time, note ) VALUES ( @income_type, @payment_type, @payment, @added_date, @added_time, @note)";
                    cmd.Parameters.Clear();
                    cmd.Parameters.AddWithValue("@income_type", "EXPENCES");
                    cmd.Parameters.AddWithValue("@payment_type", "CASH");
                    cmd.Parameters.AddWithValue("@payment", cash);
                    cmd.Parameters.AddWithValue("@added_date", DTP_GRN_DATE.Value.ToString("yyyy-MM-dd"));
                    cmd.Parameters.AddWithValue("@added_time", DTP_GRN_DATE.Value.ToString("HH:mm:ss"));
                    cmd.Parameters.AddWithValue("@note", "PAYMENT FOR GRN: " + GRN_NO);
                    cmd.ExecuteNonQuery();
                }

                if (cheque > 0)
                {
                    cmd.CommandText = "INSERT INTO account(income_type, payment_type, payment, added_date, added_time, note, cheque_no) VALUES ( @income_type, @payment_type, @payment, @added_date, @added_time, @note, @cheque_no)";
                    cmd.Parameters.Clear();
                    cmd.Parameters.AddWithValue("@income_type", "EXPENCES");
                    cmd.Parameters.AddWithValue("@payment_type", "CHEQUE");
                    cmd.Parameters.AddWithValue("@payment", cheque);
                    cmd.Parameters.AddWithValue("@added_date", DTP_GRN_DATE.Value.ToString("yyyy-MM-dd"));
                    cmd.Parameters.AddWithValue("@added_time", DTP_GRN_DATE.Value.ToString("HH:mm:ss"));
                    cmd.Parameters.AddWithValue("@note", "PAYMENT FOR GRN: " + GRN_NO);
                    cmd.Parameters.AddWithValue("@cheque_no", TXT_CHEQUE_NO.Text);
                    cmd.ExecuteNonQuery();
                }

                if (card > 0)
                {
                    cmd.CommandText = "INSERT INTO account(income_type, payment_type, payment, added_date, added_time, note , card_details) VALUES ( @income_type, @payment_type, @payment, @added_date, @added_time, @note, @card_details)";
                    cmd.Parameters.Clear();
                    cmd.Parameters.AddWithValue("@income_type", "EXPENCES");
                    cmd.Parameters.AddWithValue("@payment_type", "CARD");
                    cmd.Parameters.AddWithValue("@payment", card);
                    cmd.Parameters.AddWithValue("@added_date", DTP_GRN_DATE.Value.ToString("yyyy-MM-dd"));
                    cmd.Parameters.AddWithValue("@added_time", DTP_GRN_DATE.Value.ToString("HH:mm:ss"));
                    cmd.Parameters.AddWithValue("@note", "PAYMENT FOR GRN: " + GRN_NO);
                    cmd.Parameters.AddWithValue("@card_details", "CARD NO: " + TXT_CARD_NO.Text + " OWNER NAME: " + TXT_OWNER.Text);
                    cmd.ExecuteNonQuery();
                }



                myTrans.Commit();
                MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "GRN DATA ADDED SUCCESSFULLY!", MessageAlertImage.Success());
                mdg.ShowDialog();
                DisableControls();
                BTN_NEW.Focus();
            }
            catch (Exception EX)
            {
                Cursor.Current = Cursors.Default;
                myTrans.Rollback();
                MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), EX.Message, MessageAlertImage.Error());
                mdg.ShowDialog();
            }
            finally
            {
                Cursor.Current = Cursors.Default;
                CONNECTION.close_connection();
            }
        }
Ejemplo n.º 29
0
        private void SAVE_ITEMS()
        {
            MySqlCommand     cmd = CONNECTION.CON.CreateCommand();
            MySqlTransaction myTrans;

            myTrans         = CONNECTION.CON.BeginTransaction();
            cmd.Transaction = myTrans;
            cmd.Connection  = CONNECTION.CON;
            try
            {
                CONNECTION.open_connection();

                cmd.CommandText = "INSERT INTO item (barcode,item_category,item_name,item_type_id,item_status,qty_handle) VALUES(@barcode,@item_category,@item_name,@item_type_id,@item_status,@qty_handle)";
                cmd.Parameters.Clear();
                cmd.Parameters.AddWithValue("@barcode", "N/A");
                cmd.Parameters.AddWithValue("@item_category", CMB_CATEGORY.SelectedValue);
                cmd.Parameters.AddWithValue("@item_name", TXT_ITEMNAME.Text);
                cmd.Parameters.AddWithValue("@item_type_id", CMB_ITEM_TYPE.SelectedValue);
                cmd.Parameters.AddWithValue("@item_status", "ENABLE");
                if (CHK_QTY_HANDEL.Checked == true)
                {
                    cmd.Parameters.AddWithValue("@qty_handle", "0");
                }
                else
                {
                    cmd.Parameters.AddWithValue("@qty_handle", "1");
                }
                cmd.ExecuteNonQuery();

                LBL_ITEM_ID.Text = GETMAXID();
                if (TXT_BARCODE.Text == String.Empty)
                {
                    cmd.CommandText = "UPDATE item SET barcode=@barcode WHERE item_id=@item_id";
                    cmd.Parameters.Clear();
                    cmd.Parameters.AddWithValue("@item_id", LBL_ITEM_ID.Text);
                    cmd.Parameters.AddWithValue("@barcode", LBL_ITEM_ID.Text);
                    cmd.ExecuteNonQuery();
                }
                else
                {
                    cmd.CommandText = "UPDATE item SET barcode=@barcode WHERE item_id=@item_id";
                    cmd.Parameters.Clear();
                    cmd.Parameters.AddWithValue("@item_id", LBL_ITEM_ID.Text);
                    cmd.Parameters.AddWithValue("@barcode", TXT_BARCODE.Text);
                    cmd.ExecuteNonQuery();
                }

                if (CHK_QTY_HANDEL.Checked == true)
                {
                    cmd.CommandText = "INSERT INTO stock(item_code,qty,cost_price,sales_price) VALUES(@item_code,@qty,@cost_price,@sales_price)";
                    cmd.Parameters.Clear();
                    cmd.Parameters.AddWithValue("@item_code", LBL_ITEM_ID.Text);
                    cmd.Parameters.AddWithValue("@qty", 0.00);
                    cmd.Parameters.AddWithValue("@cost_price", Convert.ToDouble(TXT_COST_PRICE.Text));
                    cmd.Parameters.AddWithValue("@sales_price", Convert.ToDouble(TXT_SALES_PRICE.Text));
                    cmd.ExecuteNonQuery();
                }

                myTrans.Commit();
                MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "ITEM ADDED SUCCESSFULLY!", MessageAlertImage.Success());
                mdg.ShowDialog();
            }
            catch (Exception ex)
            {
                myTrans.Rollback();
                MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), ex.Message, MessageAlertImage.Error());
                mdg.ShowDialog();
            }
            finally
            {
                CONNECTION.close_connection();
            }
        }
        private void BTN_ADD_TO_MENU_Click(object sender, EventArgs e)
        {
            MySqlCommand     cmd     = CONNECTION.CON.CreateCommand();
            MySqlTransaction myTrans = null;

            try
            {
                CONNECTION.open_connection();
                cmd.Connection  = CONNECTION.CON;
                cmd.Transaction = myTrans;
                myTrans         = CONNECTION.CON.BeginTransaction();

                if (CMB_MEAL_TYPE.SelectedIndex <= -1)
                {
                    MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "PLEASE SELECT MEAL TYPE", MessageAlertImage.Warning());
                    mdg.ShowDialog();
                    CMB_MEAL_TYPE.Focus();
                }
                else if (LST_ITEMS.CheckedItems.Count <= 0)
                {
                    MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "PLEASE SELECT ITEMS TO ADD", MessageAlertImage.Warning());
                    mdg.ShowDialog();
                    LST_ITEMS.Focus();
                }
                else
                {
                    foreach (ListViewItem itm in LST_ITEMS.CheckedItems)
                    {
                        using (MySqlDataAdapter adp = new MySqlDataAdapter("SELECT id FROM daily_menu WHERE menu_date=@menu_date AND item_stock_id=@item_stock_id", CONNECTION.CON))
                        {
                            adp.SelectCommand.Parameters.Clear();
                            adp.SelectCommand.Parameters.AddWithValue("@menu_date", DTP_MENU_DATE.Value.ToString("yyyy-MM-dd"));
                            adp.SelectCommand.Parameters.AddWithValue("@item_stock_id", Convert.ToInt32(itm.SubItems[4].Text));
                            DataTable tbl = new DataTable();
                            adp.Fill(tbl);
                            if (tbl.Rows.Count <= 0)
                            {
                                cmd.CommandText = "INSERT INTO daily_menu(meal_type,item_stock_id,menu_date,added_by) VALUES(@meal_type,@item_stock_id,@menu_date,@added_by)";
                                cmd.Parameters.Clear();
                                cmd.Parameters.AddWithValue("@meal_type", CMB_MEAL_TYPE.Text);
                                cmd.Parameters.AddWithValue("@item_stock_id", Convert.ToInt32(itm.SubItems[4].Text));
                                cmd.Parameters.AddWithValue("@menu_date", DTP_MENU_DATE.Value.ToString("yyyy-MM-dd"));
                                cmd.Parameters.AddWithValue("@added_by", Convert.ToInt32(CLS_CURRENT_LOGGER.LOGGED_IN_USERID));
                                cmd.ExecuteNonQuery();
                            }
                        }
                    }
                    myTrans.Commit();
                    MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "MENU ITEMS ADDED SUCCESSFULLY", MessageAlertImage.Success());
                    mdg.ShowDialog();
                    LOAD_DAY_MENU(DTP_MENU_DATE.Value.ToString("yyyy-MM-dd"));
                    foreach (ListViewItem itm in LST_ITEMS.CheckedItems)
                    {
                        itm.Checked = false;
                    }
                }
            }
            catch (Exception EX)
            {
                myTrans.Rollback();
                MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), EX.Message, MessageAlertImage.Error());
                mdg.ShowDialog();
            }
            finally
            {
                CONNECTION.close_connection();
            }
        }