private void btnaction_Click(object sender, EventArgs e)
        {
            int    typeid = 0, manid = 0;
            double amnt = 0, busric = 0, clprc = 0, PaidMoney = 0;
            string det = "";

            try
            {
                typeid    = int.Parse(combotypes.SelectedValue.ToString());
                manid     = int.Parse(combocompany.SelectedValue.ToString());
                amnt      = double.Parse(txtamount.Text);
                busric    = double.Parse(txtbusprice.Text);
                clprc     = double.Parse(txtclntprice.Text);
                PaidMoney = double.Parse(txtpaidmny.Text);
                det       = txtdet.Text;
                if (id > 0)
                {
                    BLL.BusinesDeal.UpdateBusinesDeal(id, typeid, manid, amnt, busric, clprc, PaidMoney, det, combocompany.Text, combotypes.Text);
                    dataGridView1.DataSource = BLL.BusinesDeal.GetAllBusinesDeal();
                    MessageBox.Show("تم تعديل صفقة المشتريات لكن لن يتم تعديل المخزن");
                }
                else
                {
                    BLL.BusinesDeal.InsertBusinesDeal(0, typeid, manid, amnt, busric, clprc, busric * amnt, det, combocompany.Text, combotypes.Text);
                    BLL.Company clo = (BLL.Company)combocompany.SelectedItem; clo.Balance += ((amnt * busric) - PaidMoney); clo.UpdateCompany();
                    BLL.BllGlobal.UpdateAllCompany();
                    dataGridView1.DataSource = BLL.BusinesDeal.GetAllBusinesDeal();
                    BLL.Store.InsertStoreFromCompany(typeid, amnt, DateTime.Now, combotypes.Text);
                    //print
                    if (Globals.Globals.PrintWhenBuy)
                    {
                        try
                        {
                            List <BLL.BusinesDeal> curclnoo = new List <BLL.BusinesDeal>();
                            BLL.BusinesDeal        cr       = new BLL.BusinesDeal(0, typeid, manid, amnt, busric, clprc, busric * amnt, det, MyDateTime.Now, combocompany.Text, combotypes.Text);
                            curclnoo.Add(cr);
                            dataGridView1.DataSource = curclnoo;
                            if ((int)combocompany.SelectedValue != Globals.Globals.UnknownClient)
                            {
                                Globals.Globals.PrintNow(dataGridView1, @"السيد المحترم " + combocompany.Text, " المدفوع " + PaidMoney.ToString() + " ل.س "
                                                         + Environment.NewLine + " الباقي " + ((amnt * busric) - PaidMoney).ToString() + " ل.س "
                                                         + Environment.NewLine + string.Format("المجموع {0} ل.س ", (amnt * busric).ToString()), true);
                            }
                            else
                            {
                                Globals.Globals.PrintNow(dataGridView1, @"بتوقيت:", string.Format("المجموع {0} ل.س ", ((amnt * busric).ToString())), true);
                            }
                        }
                        catch { }
                    }

                    //end print
                    this.label12.Text = (BLL.BusinesDeal.GetAllTotalPrice(DateTime.Now, DateTime.Now)).ToString();
                }


                btnnew_Click(sender, e);
            }
            catch { SelectTheEmptyText(this.groupBox1); }
        }
예제 #2
0
        public ActionResult List()
        {
            StringBuilder sb    = new StringBuilder();
            int           page  = int.Parse(Request.QueryString["page"].ToString());
            int           limit = int.Parse(Request.QueryString["limit"].ToString());

            string where = "1=1";
            if (!String.IsNullOrEmpty(Request.QueryString["name"]))
            {
                where += " and CompanyName like '%" + Request.QueryString["name"] + "%'";
            }

            DataTable dt = new BLL.Company().GetListByPage(where, "id", (page - 1) * limit, page * limit).Tables[0];

            sb.Append("{\"status\": 200,\"message\": \"\",\"total\": " + new BLL.Company().GetRecordCount(where) + ",\"rows\": {\"item\": [");
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (i > 0)
                {
                    sb.Append(",");
                }
                sb.Append("{\"id\":" + dt.Rows[i]["id"] + ",\"companymame\":\"" + dt.Rows[i]["CompanyName"] + "\",\"address\":\"" + dt.Rows[i]["Address"] + "\",\"contact\":\"" + dt.Rows[i]["contact"] + "\",\"phone\":\"" + dt.Rows[i]["phone"] + "\"}");
            }
            sb.Append("]}}");

            return(Content(sb.ToString()));
        }
        private void btnaction_Click(object sender, EventArgs e)
        {
            int    typeid = 0, manid = 0;
            double amnt = 0, busric = 0, clprc = 0, PaidMoney = 0;
            string det = "";

            try
            {
                typeid    = int.Parse(combotypes.SelectedValue.ToString());
                manid     = int.Parse(combocompany.SelectedValue.ToString());
                amnt      = double.Parse(txtamount.Text);
                busric    = double.Parse(txtbusprice.Text);
                clprc     = double.Parse(txtclntprice.Text);
                PaidMoney = double.Parse(txtpaidmny.Text);
                det       = txtdet.Text;
                if (id > 0)
                {
                    BLL.BusinesReturns.UpdateBusinesDeal(id, typeid, manid, amnt, busric, clprc, PaidMoney, det, combocompany.Text, combotypes.Text);
                    dataGridView1.DataSource = BLL.BusinesReturns.GetAllBusinesDeal();
                    MessageBox.Show("تم تعديل  المشتريات لكن لن يتم تعديل المخزن");
                }
                else
                {
                    if (BLL.Store.GetStoreByTypeID(typeid).Amount < amnt)
                    {
                        MessageBox.Show("لا تستطيع ارجاع كمية ليست متوفرة في المخزن"); return;
                    }
                    BLL.BusinesReturns.InsertBusinesDeal(0, typeid, manid, amnt, busric, clprc, busric * amnt, det, combocompany.Text, combotypes.Text);

                    if (checkBox1.Checked)
                    {
                        BLL.Company clo = (BLL.Company)combocompany.SelectedItem;
                        clo.Balance -= ((amnt * busric));
                        clo.UpdateCompany();
                    }
                    BLL.BllGlobal.UpdateAllCompany();
                    dataGridView1.DataSource = BLL.BusinesReturns.GetAllBusinesDeal();
                    BLL.Store.InsertStoreFromCompany(typeid, amnt, DateTime.Now, combotypes.Text, true);
                }


                btnnew_Click(sender, e);
            }
            catch { SelectTheEmptyText(this.groupBox1); }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            button1.Enabled = false;
            BLL.Company clno     = (BLL.Company)cmcmps.SelectedItem;
            double      blanceee = clno.Balance;

            if (clno.Balance >= 0)
            {
                clno.Balance = clno.Balance - double.Parse(numbertextbox1.Text);
            }
            else
            {
                clno.Balance = clno.Balance + double.Parse(numbertextbox1.Text);
            }

            clno.UpdateCompany();
            BLL.BllGlobal.UpdateAllCompany();
            BLL.ListCompanytAccount.InsertCompanytAccount(int.Parse(cmcmps.SelectedValue.ToString()), double.Parse(label10.Text), double.Parse(numbertextbox1.Text), (double.Parse(label10.Text) - double.Parse(numbertextbox1.Text)));
            cmcmps_SelectedIndexChanged(Sendo, eo);
            button1.Enabled = true;
        }