Beispiel #1
0
 private void btn_save_Click(object sender, EventArgs e)
 {
     if (dataGridView1.Rows.Count > 0)
     {
         for (int a = 0; a < dataGridView1.Rows.Count; a++)
         {
             string    item     = (dataGridView1.Rows[a].Cells["cal_item_name"].Value.ToString());
             decimal   quantity = Convert.ToDecimal(dataGridView1.Rows[a].Cells["cal_qty"].Value.ToString());
             decimal   cost     = Convert.ToDecimal(dataGridView1.Rows[a].Cells["cal_cost"].Value.ToString());
             decimal   total    = Convert.ToDecimal(dataGridView1.Rows[a].Cells["cal_total"].Value.ToString());
             DataTable dt       = blord.getallbyitem_name(item);
             if (dt.Rows.Count > 0)
             {
                 im.ingredientManage(Convert.ToInt32(dt.Rows[0]["item_id"]), quantity);//item sales wise stock decrease
                 int insert = blim.StockWasteInsert(Convert.ToInt32(dt.Rows[0]["item_id"]), quantity, Convert.ToDateTime(today));
                 MessageBox.Show("Successfully Inserted Waste", "Insert Data Alert !!");
                 dataGridView1.Rows.Clear();
             }
         }
     }
     else
     {
         MessageBox.Show("Nothing To Save", "No Data Alert !!");
     }
 }
Beispiel #2
0
 private void cbo_item_name_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cbo_item_name.Text != "" && cbo_item_name.Text != "Choose One")
     {
         DataTable dt = blod.getallbyitem_name(cbo_item_name.Text);
         if (dt.Rows.Count > 0)
         {
             txtitemprice.Text = dt.Rows[0]["item_price"].ToString();
             txt_kot_type.Text = dt.Rows[0]["kot_print"].ToString();
         }
     }
 }
Beispiel #3
0
        public void datagrid_Load()
        {
            if (datagridview_item_name.Count > 0)
            {
                dataGridView1.Rows.Clear();
                for (int i = 0; i < datagridview_item_name.Count; i++)
                {
                    int abc = dataGridView1.Rows.Add();
                    dataGridView1.Rows[i].Cells["cal_item_name"].Value = datagridview_item_name[i];

                    dataGridView1.Rows[i].Cells["cal_qty"].Value = datagridview_quantity[i];
                    DataTable dt1 = blord.getallbyitem_name(datagridview_item_name[i]);
                    if (dt1.Rows.Count > 0)
                    {
                        int item_id = Convert.ToInt32(dt1.Rows[0]["item_id"].ToString());
                        dataGridView1.Rows[i].Cells["col_item_id"].Value = item_id.ToString();
                        if (dt1.Rows[0]["discount"].ToString() == null || dt1.Rows[0]["discount"] == DBNull.Value)
                        {
                            dataGridView1.Rows[i].Cells["col_discount"].Value = 0.00;
                        }
                        else
                        {
                            discount = Convert.ToDecimal(dt1.Rows[0]["discount"].ToString());
                            dataGridView1.Rows[i].Cells["col_discount"].Value = discount.ToString();
                        }
                        //if ((dt1.Rows[0]["discount"].ToString()) == null)
                        //{
                        //    dataGridView1.Rows[i].Cells["col_discount"].Value = 0.00;
                        //}
                        //else
                        //{
                        //    dataGridView1.Rows[i].Cells["col_discount"].Value = Convert.ToDecimal(dt1.Rows[0]["discount"].ToString());
                        //}
                        DataTable dt2 = blli.GetItemCost(item_id);
                        if (dt2.Rows.Count > 0)
                        {
                            dataGridView1.Rows[i].Cells["col_estimate"].Value = Convert.ToDecimal(datagridview_quantity[i]) * Convert.ToDecimal(dt2.Rows[0]["total_cost"].ToString());
                        }
                    }
                    dataGridView1.Rows[i].Cells["cal_cost"].Value  = datagridview_item_price[i];
                    dataGridView1.Rows[i].Cells["cal_total"].Value = datagridview_total[i];
                }
                calculate_total();
            }
            hotDiscount();
        }