예제 #1
0
 private void btnView_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     try
     {
         if (gvInvoice.FocusedRowHandle >= 0)
         {
             DataSet ds = ObjStockRep.GetInvoice(gvInvoice.GetFocusedRowCellValue("STOCKENTRYID"));
             if (ds != null && ds.Tables.Count > 1)
             {
                 rptInvoice rpt = new rptInvoice(ds.Tables[0], ds.Tables[1]);
                 rpt.ShowPrintMarginsWarning = false;
                 rpt.ShowRibbonPreview();
             }
         }
     }
     catch (Exception ex)
     {
         ErrorMgmt.ShowError(ex);
         ErrorMgmt.Errorlog.Error(ex);
     }
 }
        private void btnSaveInvoice_Click(object sender, EventArgs e)
        {
            try
            {
                int iValue = 0;
                if (int.TryParse(Convert.ToString(ObjStockEntry.STOCKENTRYID), out iValue) && iValue > 0)
                {
                    if (!dxValidationProvider1.Validate())
                    {
                        return;
                    }
                    ObjStockRep.UpdateInvoice(ObjStockEntry);

                    DataSet    ds  = ObjStockRep.GetInvoice(ObjStockEntry.STOCKENTRYID);
                    rptInvoice rpt = new rptInvoice(ds.Tables[0], ds.Tables[1]);
                    rpt.ShowPrintMarginsWarning = false;
                    rpt.ShowRibbonPreview();
                    cmbSupplier.EditValue      = null;
                    txtInvoiceNumber.EditValue = null;
                    dtpInvoice.EditValue       = DateTime.Now;
                    txtTCS.EditValue           = null;
                    txtDiscountPer.EditValue   = null;
                    txtDiscountFlat.EditValue  = null;
                    txtExpenses.EditValue      = null;
                    txtTransport.EditValue     = null;
                    cmbSupplier.Enabled        = true;
                    txtInvoiceNumber.Enabled   = true;
                    dtpInvoice.Enabled         = true;
                    ObjStockEntry.STOCKENTRYID = 0;
                    ObjStockEntry.dtStockEntry = new DataTable();
                    gcStockEntry.DataSource    = ObjStockEntry.dtStockEntry;
                    cmbSupplier.Focus();
                }
            }
            catch (Exception ex)
            {
                ErrorMgmt.ShowError(ex);
                ErrorMgmt.Errorlog.Error(ex);
            }
        }