示例#1
0
 void worker_DoWork(object sender, DoWorkEventArgs e)
 {
     dr = new autocomplete().getdatatable("select l_name,l_id from ledger where l_groupid = 2", "ledger");
     dr1 = new autocomplete().getdatatable("select com_name , com_id,com_balstock,com_sp from [stock]", "[stock]");
     sr = new salesmodel().getsalesreport();
     sor = new salesmodel().getsalesorderreport();
     vid = new salesmodel().getvid();
     f = new Fillcombo("u_sym", "uom");
     orderid = new salesmodel().getordervid();
 }
示例#2
0
 private void button1_Click(object sender, RoutedEventArgs e)
 {
     if (sc.Count != 0)
     {
         int tid = new transactionmodel().getid();
         sales s = new sales()
         {
             tid = tid,
             lid = lid,
             stotal = total,
             sdate = datePicker1.ToString(),
             sid = int.Parse(txtvno.Text),
             tnsp_chg = addcharges.ToString(),
             vat_chg = vat.ToString(),
             roundof = roundof.ToString(),
             nettotal = Double.Parse(txttotalamount.Text),
             discount = "0"
         };
         List<salesitem> sl = sc.ToList<salesitem>();
         salesmodel sm = new salesmodel(s, sl, total);
         if (sm.insert())
         {
             Show("Saved Succesfully",1);
             int i = application.tb.Where(x => x.Lid == lid).Select<ledgerbalance, int>(x => application.tb.IndexOf(x)).Single<int>();
             application.tb[i].Balance = application.tb[i].Balance + Double.Parse(txttotalamount.Text);
             application.tb[i].CurrBalance = application.tb[i].Balance.ToString("C2");
             application.tb[i].BalanceType = "cr";
             sc.Clear();
             reset();
             txtvno.Text = sm.getvid().ToString();
         }
     }
     else
     {
        Show("Fields cannot be empty",2);
     }
 }
示例#3
0
        private void lst_report_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (lst_report.SelectedValue != null)
            {

                lbl_header.Content = "Sales Invoice";
                salesreport sr = (salesreport)lst_report.SelectedValue;
                sales s;
                if (invoicedetail)
                {
                    listBox2.ItemsSource = new salesitemmodel().getinvoicedetail(int.Parse(sr.vid));
                    s = new salesmodel().getinvoicedetail(int.Parse(sr.vid));
                    rp_datePicker.Text = s.sdate;
                    rp_customer.Content = s.lname;
                    rp_round.Content = s.roundof;
                    rp_tnsp.Content = s.tnsp_chg;
                    rp_total.Content = s.stotal;
                    rp_vatrate.Content = s.vat_chg;
                    rp_vno.Content = s.sid.ToString();
                    lid = s.lid;
                    rp_vat.Content = (Math.Round(double.Parse(s.vat_chg) / s.stotal * 100, 2)).ToString();
                    sales_report.Visibility = Visibility.Hidden;
                    invoice_details.Visibility = Visibility.Visible;
                }
                else
                {
                    reset();
                    List<salesitem> soc = new salesitemmodel().getorderedetail(int.Parse(sr.vid));
                    foreach (var item in soc)
                    {

                        salesitem sa = new salesitem()
                        {
                            sid = int.Parse(txtvno.Text),
                            scomname = item.scomname,
                            scomid = item.scomid,
                            sqnty = item.sqnty,
                             suom = item.suom,
                            srate = item.srate,
                            samt = item.samt,
                        };
                        sc.Add(sa);
                    }
                    s = new salesmodel().getorderdetail(int.Parse(sr.vid));
                    sales_report.Visibility = Visibility.Hidden;
                    ((Storyboard)this.Resources["common_sale"]).Begin();
                    invoicenumber();
                    btncomitorder.Visibility = Visibility.Visible;
                    button1.Visibility = Visibility.Hidden;
                    txtcustomer.Text = s.lname;
                    txttotalamount.Text = s.nettotal.ToString();
                    total = s.stotal;
                    lid = s.lid;
                    comitoid = s.sid;
                    txtacrate.Focus();
                }
            }
        }
示例#4
0
 private void btnorder1_Click(object sender, RoutedEventArgs e)
 {
     if (sc.Count != 0)
     {
        // int tid = new transactionmodel().getid();
         sales s = new sales()
         {
         //   tid = tid,
             lid = lid,
             stotal = total,
             sdate = datePicker1.ToString(),
             sid = int.Parse(txtorderno.Text),
           /// tnsp_chg = addcharges.ToString(),
            //////// vat_chg = vat.ToString(),
           //  roundof = roundof.ToString(),
             nettotal = Double.Parse(txttotalamount.Text),
           //  discount = "0"
         };
         List<salesitem> sl = sc.ToList<salesitem>();
         salesmodel sm = new salesmodel(s, sl, total);
         if (sm.orderinsert())
         {
             Show("Saved Sucessfully",1);
             sc.Clear();
             reset();
             txtorderno.Text = sm.getordervid().ToString();
         }
     }
     else
     {
        Show("Please enter some details",2);
     }
 }