Example #1
0
        private void btnSeleccionar_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            DateTime Fecha = Convert.ToDateTime(date_Fecha.EditValue.ToString());
            string   tfamini, tfamfin, tsubini, tsubfin, tincluyecero;

            if (glue_FamIni.EditValue == null)
            {
                tfamini = "00";
            }
            else
            {
                tfamini = glue_FamIni.EditValue.ToString();
            }
            if (glue_FamFin.EditValue == null)
            {
                tfamfin = "99";
            }
            else
            {
                tfamfin = glue_FamFin.EditValue.ToString();
            }
            if (glue_SubIni.EditValue == null)
            {
                tsubini = "0000";
            }
            else
            {
                tsubini = glue_SubIni.EditValue.ToString();
            }
            if (glue_SubFin.EditValue == null)
            {
                tsubfin = "9999";
            }
            else
            {
                tsubfin = glue_SubFin.EditValue.ToString();
            }


            if (check_Cero.Checked)
            {
                tincluyecero = "S";
            }
            else
            {
                tincluyecero = "N";
            }
            Rpt_Inventario R = new Rpt_Inventario(Fecha.Year.ToString() + DosCero(Fecha.Month.ToString()) + DosCero(Fecha.Day.ToString()), glue_Empresas.EditValue.ToString(), tfamini, tfamfin, tsubini, tsubfin, tincluyecero);



            DevExpress.XtraReports.UI.ReportPrintTool Rpt = new DevExpress.XtraReports.UI.ReportPrintTool(R);
            Rpt.ShowPreviewDialog();
        }
        private void btnPrintChallan_Click(object sender, EventArgs e)
        {
            try
            {
                DataSet ldts   = new DataSet();
                Int32   lInvId = 0;
                if (mInvId > 0)
                {
                    lInvId = mInvId;
                }
                else
                {
                    lInvId = Convert.ToInt16(xListDetail.GetRowCellValue(xListDetail.FocusedRowHandle, "InvId").ToString());
                }
                Inv_DatabaseEntities dbx = new Inv_DatabaseEntities();
                var querymst             = from c in dbx.InvoiceMsts where c.InvId == lInvId select c;
                var querydet             = from c in dbx.InvoiceDets where c.InvId == lInvId select c;
                var querycustomer        = from c in dbx.CustomerMsts where c.CustomerId == querymst.FirstOrDefault().CustomerId select c;
                var querycompany         = from c in dbx.CompanyMsts select c;
                var queryitm             = from c in dbx.ItemMsts select c;

                ldts.Tables.Add(AppFun.EntityToDataTable(querycompany.ToList()));
                ldts.Tables.Add(AppFun.EntityToDataTable(querycustomer.ToList()));
                ldts.Tables.Add(AppFun.EntityToDataTable(querydet.ToList()));
                ldts.Tables.Add(AppFun.EntityToDataTable(querymst.ToList()));

                int    netamt = Convert.ToInt32(querymst.FirstOrDefault().NetAmt);
                string InrRup = AppFun.NumberToWords(netamt);



                ldts.DataSetName         = "Source1";
                ldts.Tables[0].TableName = "CompanyMst";
                ldts.Tables[1].TableName = "CustomerMst";
                ldts.Tables[2].TableName = "InvoiceDet";
                ldts.Tables[3].TableName = "InvoiceMst";


                DevExpress.XtraReports.UI.XtraReport report = DevExpress.XtraReports.UI.XtraReport.FromFile(Environment.CurrentDirectory + @"\Reports\" + AppInit.SoftwareSettings.Inv_challanformatValue, true);
                //DevExpress.XtraReports.UI.XtraReport report =new DevExpress.XtraReports.UI.XtraReport();
                //report.LoadLayout(Environment.CurrentDirectory + @"\Reports\" + AppInit.SoftwareSettings.Inv_invoiceformateValue);

                DevExpress.XtraReports.UI.ReportPrintTool tool = new DevExpress.XtraReports.UI.ReportPrintTool(report);
                report.RequestParameters         = false;
                report.Parameters["Inr"].Value   = InrRup;
                report.Parameters["Inr"].Visible = false;
                if (cmbCopy.Text.Length > 0)
                {
                    report.Parameters["Copy"].Value   = cmbCopy.Text;
                    report.Parameters["Copy"].Visible = false;
                }
                //report.Parameters.Add(new DevExpress.XtraReports.Parameters.Parameter() { Name = "Inr", Type = typeof(string), Value = InrRup, Description = "Inr" });
                report.DataSource = ldts;
                report.DataMember = ldts.Tables[2].TableName;
                tool.ShowPreviewDialog();
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message);
            }
        }
 private void btnPrintView_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (!dxValidationProvider1.Validate())
     {
         XtraMessageBox.Show("数据完整性校验失败. ", "错误提示", MessageBoxButtons.OK);
         return;
     }
     rptPatientRegist rpt = new rptPatientRegist(patientReg);
     DevExpress.XtraReports.UI.ReportPrintTool rptPrint = new DevExpress.XtraReports.UI.ReportPrintTool(rpt);
     rptPrint.ShowPreviewDialog();
 }