Пример #1
0
 private void btncomitorder_Click(object sender, RoutedEventArgs e)
 {
     if (pc.Count != 0)
     {
         int tid = new transactionmodel().getid();
         purchase s = new purchase()
         {
             tid = tid,
             lid = lid,
             ptotal = total,
             pdate = datePicker1.ToString(),
             pid = vid,
             tnsp_chg = addcharges.ToString(),
             vat_chg = vat.ToString(),
             roundof = roundof.ToString(),
             nettotal = Double.Parse(txttotalamount.Text),
             discount = "0"
         };
         List<purchaseitem> sl = pc.ToList<purchaseitem>();
         purchasemodel sm = new purchasemodel(s, sl, total);
         if (sm.comitorder(comitoid))
         {
             Show("Data Saved",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 = "dr";
             pc.Clear();
             reset();
             vid = int.Parse(sm.getvid().ToString());
         }
     }
     else
     {
         Show("Fields Cannot be empty",2);
     }
 }
Пример #2
0
        private void lst_report_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (lst_report.SelectedValue != null)
            {

                lbl_header.Content = "Purchase Invoice";
                purchasereport sr = (purchasereport)lst_report.SelectedValue;
                purchase s;
                if (invoicedetail)
                {
                    listBox2.ItemsSource = new purchaseitemmodel().getinvoicedetail(int.Parse(sr.vid));
                    s = new purchasemodel().getinvoicedetail(int.Parse(sr.vid));
                    rp_datePicker.Text = s.pdate;
                    rp_customer.Content = s.lname;
                    rp_round.Content = s.roundof;
                    rp_tnsp.Content = s.tnsp_chg;
                    rp_total.Content = s.ptotal;
                    rp_vatrate.Content = s.vat_chg;
                    rp_vno.Content = s.pid.ToString();
                    rp_vat.Content = (Math.Round(double.Parse(s.vat_chg) / s.ptotal * 100, 2)).ToString();
                    purchase_report.Visibility = Visibility.Hidden;
                    invoice_details.Visibility = Visibility.Visible;
                }
                else
                {
                    reset();
                    List<purchaseitem> soc = new purchaseitemmodel().getorderedetail(int.Parse(sr.vid));
                    foreach (var item in soc)
                    {

                        purchaseitem sa = new purchaseitem()
                        {
                            pid = vid,
                            pcomname = item.pcomname,
                            pcomid = item.pcomid,
                            pqnty = item.pqnty,
                            puom = item.puom,
                            prate = item.prate,
                            pamt = item.pamt,
                        };
                        pc.Add(sa);
                    }
                    s = new purchasemodel().getorderdetail(int.Parse(sr.vid));
                    purchase_report.Visibility = Visibility.Hidden;
                    purchase.Visibility = Visibility.Visible;
                    invoicenumber();
                    btncomitorder.Visibility = Visibility.Visible;
                    button1.Visibility = Visibility.Hidden;
                    txtcustomer.Text = s.lname;
                    txttotalamount.Text = s.nettotal.ToString();
                    total = s.ptotal;
                    lid = s.lid;
                    comitoid = s.pid;
                    txtacrate.Focus();
                }
            }
        }
Пример #3
0
 void worker_DoWork(object sender, DoWorkEventArgs e)
 {
     dr = new autocomplete().getdatatable("select l_name,l_id from ledger where l_groupid = 3", "ledger");
     dr1 = new autocomplete().getdatatable("select com_name , com_id,com_balstock,com_sp from [stock]", "[stock]");
     pr = new purchasemodel().getpurchasereport();
     por = new purchasemodel().getpurchaseorderreport();
     vid = new purchasemodel().getvid();
     f = new Fillcombo("u_sym", "uom");
       orderid = new purchasemodel().getordervid();
 }
Пример #4
0
        private void btnorder_Click(object sender, RoutedEventArgs e)
        {
            if (pc.Count != 0)
            {
                // int tid = new transactionmodel().getid();
                purchase s = new purchase()
                {

                    //   tid = tid,
                    lid = lid,
                    ptotal = total,
                    pdate = datePicker1.ToString(),
                    pid = int.Parse(txtorderno.Text),
                    /// tnsp_chg = addcharges.ToString(),
                    //////// vat_chg = vat.ToString(),
                    //  roundof = roundof.ToString(),
                    nettotal = Double.Parse(txttotalamount.Text),
                    //  discount = "0"
                };
                List<purchaseitem> sl = pc.ToList<purchaseitem>();
                purchasemodel sm = new purchasemodel(s, sl, total);
                if (sm.orderinsert())
                {
                    Show("Data Saved", 1);
                    pc.Clear();
                    reset();
                    txtorderno.Text = sm.getordervid().ToString();
                    orderid = int.Parse(txtorderno.Text);
                }
            }
            else
            {
               Show("Fields Cannot be empty",2);
            }
        }