Exemple #1
0
 void changeprice(object sender)
 {
     BLL.Types xx = null;
     xx = (BLL.Types)combotypes.SelectedItem;
     if ((sender as RadioButton).Text.Equals("جملة"))
     {
         txtclntprice.Text = xx.BusinessClientPrice.ToString();
     }
     else
     {
         txtclntprice.Text = xx.ClientPrice.ToString();
     }
 }
Exemple #2
0
 private void combotypes_SelectedIndexChanged(object sender, EventArgs e)
 {
     try{
         int       x  = 0;
         BLL.Types xx = null;
         x  = int.Parse(combotypes.SelectedValue.ToString());
         xx = BLL.Types.GetTypeByID(x);
         txtclntprice.Text = xx.ClientPrice.ToString();
         settingoControl1.Refresh(xx.TheUnit);
         if ((baraCode128vewier1.Text.Length > 0) && (!string.IsNullOrEmpty(baraCode128vewier1.Text) && baraCode128vewier1.Text != " "))
         {
             btnaction_Click(sender, e);
         }
     }catch {}
 }
        private object PleseGivespecialComapny(int p)
        {
            BLL.Types          tp   = BLL.Types.GetTypeByID(p);
            List <BLL.Company> all2 = new List <WeightsOrganizer.BLL.Company>();

            if ((!string.IsNullOrEmpty(tp.AllCompanyId)) && (tp.AllCompanyId.Length != 0) && (tp.AllCompanyId != " "))
            {
                string[] all = tp.AllCompanyId.Split(',');
                foreach (string s in all)
                {
                    all2.Add(BLL.Company.GetCompanyByID(int.Parse(s)));
                }
            }
            return(all2);
        }
        private void btnaction_Click(object sender, EventArgs e)
        {
            int    typeid = 0, manid = 0;
            double amnt = 0, clprc = 0, PaidMoney = 0;
            string det = "";

            BLL.Types tppp = null;
            try
            {
                typeid    = int.Parse(combotypes.SelectedValue.ToString());
                manid     = int.Parse(combocompany.SelectedValue.ToString());
                amnt      = double.Parse(txtamount.Text);
                clprc     = double.Parse(txtclntprice.Text);
                PaidMoney = double.Parse(txtpaidmny.Text);
                det       = txtdet.Text;
                tppp      = (BLL.Types)combotypes.SelectedItem;
                TheUnito TheUnito = TheUnito.Kilo;
                TheUnito = (TheUnito)Enum.Parse(typeof(TheUnito), Globals.Globals.gram.ToString());
                if (id > 0)
                {
                    //  MessageBox.Show(string.Format("{0}  {1} {2} {3} {4} {5} {6}",id.ToString(), typeid.ToString(), manid.ToString(), amnt.ToString(), clprc.ToString(), PaidMoney.ToString(), det));
                    BLL.SalesReturns.UpdateClientDeal(id, typeid, manid, amnt, clprc, PaidMoney, det, 0, combocompany.Text, combotypes.Text);
                    dataGridView1.DataSource = BLL.SalesReturns.GetAllClientDeal();
                }
                else
                {
                    double stramnt = amnt;
                    if (Globals.Globals.gram == 0)
                    {
                        stramnt = amnt / 1000;
                    }
                    BLL.Store.InsertStoreFromClient(typeid, stramnt, DateTime.Now, combotypes.Text, true);
                    BLL.SalesReturns.InsertClientDeal(0, typeid, manid, amnt, clprc, amnt * clprc, det, TheUnito, tppp.BusinessPrice, combocompany.Text, combotypes.Text);

                    BLL.Client clo = BLL.Client.GetClientByID(manid);
                    if (clo.ID != Globals.Globals.UnknownClient)
                    {
                        clo.Balance -= ((amnt * clprc)); clo.UpdateClient();
                        BLL.BllGlobal.UpdateAllClients();
                    }
                    dataGridView1.DataSource = BLL.SalesReturns.GetAllClientDeal();
                }

                btnnew_Click(sender, e);
            }
            catch { SelectTheEmptyText(this.groupBox1); }
        }
 private void combotypes_SelectedIndexChanged(object sender, EventArgs e)
 {
     try{
         int       x  = 0;
         BLL.Types xx = null;
         x  = int.Parse(combotypes.SelectedValue.ToString());
         xx = BLL.Types.GetTypeByID(x);
         if (id == 0)
         {
             combocompany.DataSource = Globals.Globals.PleseGivespecialComapny(int.Parse(combotypes.SelectedValue.ToString()));
         }
         else
         {
             combocompany.DataSource = BLL.BllGlobal.allcomps;
         }
         txtclntprice.Text = xx.ClientPrice.ToString();
         txtbusprice.Text  = xx.BusinessPrice.ToString();
         label14.Text      = " الوحدة " + xx.ArabicUnit;
     }catch {}
 }
 private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (DontCatch)
     {
         if (e.KeyChar == 13)
         {
             try
             {
                 thecode   = textBox1.Text;
                 e.Handled = true;
                 typcode   = BLL.Types.GetTypeByBaraCode(thecode, InStore)[0];
                 if ((typcode != null))
                 {
                     (CtrlType as ComboBox).SelectedValue = typcode.ID;
                     typcode = null;
                 }
             }
             catch (Exception) { MessageBox.Show(ErrStromsg, "قارئ الباراكود"); }
             textBox1.Text = "";
         }
     }
 }
Exemple #7
0
        private void btnaction_Click(object sender, EventArgs e)
        {
            int    typeid = 0, manid = 0;
            double amnt = 0, clprc = 0, PaidMoney = 0;
            string det = "";

            BLL.Types tppp = null;
            try
            {
                typeid    = int.Parse(combotypes.SelectedValue.ToString());
                manid     = int.Parse(combocompany.SelectedValue.ToString());
                amnt      = double.Parse(txtamount.Text);
                clprc     = double.Parse(txtclntprice.Text);
                PaidMoney = double.Parse(txtpaidmny.Text);
                det       = txtdet.Text;
                tppp      = (BLL.Types)combotypes.SelectedItem;
                TheUnito TheUnito = TheUnito.Kilo;
                TheUnito = (TheUnito)Enum.Parse(typeof(TheUnito), Globals.Globals.gram.ToString());
                if (id > 0)
                {
                    //  MessageBox.Show(string.Format("{0}  {1} {2} {3} {4} {5} {6}",id.ToString(), typeid.ToString(), manid.ToString(), amnt.ToString(), clprc.ToString(), PaidMoney.ToString(), det));
                    BLL.ClientDeal.UpdateClientDeal(id, typeid, manid, amnt, clprc, PaidMoney, det, 0, combocompany.Text, combotypes.Text);
                    dataGridView1.DataSource = BLL.ClientDeal.GetAllClientDeal();
                }
                else
                {
                    double stramnt = amnt;
                    if (Globals.Globals.gram == 0)
                    {
                        stramnt = amnt / 1000;
                    }
                    if (BLL.Store.InsertStoreFromClient(typeid, stramnt, DateTime.Now, combotypes.Text) == 0)
                    {
                        return;
                    }

                    BLL.ClientDeal.InsertClientDeal(0, typeid, manid, amnt, clprc, amnt * clprc, det, TheUnito, tppp.BusinessPrice, combocompany.Text, combotypes.Text);
                    BLL.Client clo = BLL.Client.GetClientByID(manid); clo.Balance += ((amnt * clprc) - PaidMoney); clo.UpdateClient();
                    //print
                    if (Globals.Globals.PrintWhenSell)
                    {
                        try
                        {
                            List <BLL.ClientDeal> curclnoo = new List <BLL.ClientDeal>();
                            BLL.ClientDeal        cr       = new ClientDeal(0, typeid, manid, amnt, clprc, amnt * clprc, det, MyDateTime.Now, TheUnito, tppp.BusinessPrice, 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 * clprc) - PaidMoney).ToString() + " ل.س "
                                                         + Environment.NewLine + string.Format("المجموع {0} ل.س ", (amnt * clprc).ToString()), true);
                            }
                            else
                            {
                                Globals.Globals.PrintNow(dataGridView1, @"بتوقيت:", string.Format("المجموع {0} ل.س ", ((amnt * clprc).ToString())), true);
                            }
                        }
                        catch { }
                    }

                    //end print
                    BLL.BllGlobal.UpdateAllClients();
                    if (txtpaidmny.Text.Length > 0)
                    {
                        if (double.Parse(handclnt.Text) > PaidMoney)
                        {
                            MessageBox.Show(" الباقي للزبون   " + (double.Parse(handclnt.Text) - PaidMoney).ToString() + "  ل.س  ");
                        }
                    }
                    dataGridView1.DataSource = BLL.ClientDeal.GetAllClientDeal();
                }

                btnnew_Click(sender, e);
            }
            catch { SelectTheEmptyText(this.groupBox1); }
        }