예제 #1
0
 private void Proforma_Invoice_Load(object sender, EventArgs e)
 {
     if (proinvoiceno != null)
     {
         txtinvoice.Text = proinvoiceno;
         Sale.Database.PerformanceInvoiceData p2 = new Sale.Database.PerformanceInvoiceData();
         p2.FnConn();
         DataSet   ds      = p2.FillDataSet("searchgrid", proinvoiceno, "spperformanceInvoice");
         DataTable inv     = ds.Tables[0];
         DataTable invgrid = ds.Tables[1];
         p2.FnTrans();
         if (inv.Rows.Count > 0)
         {
             Commen_Form.Functions.DateConverter dc = new Commen_Form.Functions.DateConverter();
             dtpdate.EditValue      = dc.dateconverter(inv.Rows[0]["date"] + "");
             txtbillto.Text         = inv.Rows[0]["billto"] + "";
             txtbilladdress.Text    = inv.Rows[0]["billaddress"] + "";
             txtshipto.Text         = inv.Rows[0]["shipto"] + "";
             txtshipaddress.Text    = inv.Rows[0]["shipaddress"] + "";
             txtnotes.Text          = inv.Rows[0]["note"] + "";
             txtsubtotal.Text       = inv.Rows[0]["sutotal"] + "";
             txttax.Text            = inv.Rows[0]["tax"] + "";
             txtship.Text           = inv.Rows[0]["shipping"] + "";
             txtgrandtotal.Text     = inv.Rows[0]["grandtotal"] + "";
             barButtonItem1.Enabled = false;
         }
         if (invgrid.Rows.Count > 0)
         {
             gridControl1.DataSource = invgrid;
         }
     }
     else
     {
         Sale.Database.PerformanceInvoiceData pi = new Sale.Database.PerformanceInvoiceData();
         pi.FnConn();
         DataTable dt = pi.FillData("M", "", "spperformanceInvoice");
         pi.FnTrans();
         if (dt.Rows.Count > 0)
         {
             int    number = Convert.ToInt32(dt.Rows[0][0].ToString()) + 1;
             string num    = number + "";
             num             = "PRI/" + num.PadLeft(5, '0');
             txtinvoice.Text = num;
         }
         dtpdate.EditValue = DateTime.Now;
         DataTable dt3 = new DataTable();
         dt3.Columns.Add("slno", Type.GetType("System.Int32"));
         dt3.Columns.Add("pinvoice_no", Type.GetType("System.String"));
         dt3.Columns.Add("itemCode", Type.GetType("System.String"));
         dt3.Columns.Add("description", Type.GetType("System.String"));
         dt3.Columns.Add("quantity", Type.GetType("System.Double"));
         dt3.Columns.Add("unitPrice", Type.GetType("System.Double"));
         dt3.Columns.Add("amount", Type.GetType("System.Double"));
         dt3.Columns.Add("status", Type.GetType("System.String"));
         gridControl1.DataSource = dt3;
     }
 }
        void loaddata()
        {
            Sale.Database.PerformanceInvoiceData pi = new Sale.Database.PerformanceInvoiceData();
            pi.FnConn();
            DataTable dt = pi.FillData("S", "", "spperformanceInvoice");

            if (dt.Rows.Count > 0)
            {
                gridControl1.DataSource = dt;
            }
        }