Beispiel #1
0
        private void bbi_Print_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            InvoiceOwnerDTO oRow = (InvoiceOwnerDTO)gcv_Invoice.GetFocusedRow();

            if (oRow != null)
            {
                var trans = _repository.Run <InvoiceService, List <InvoiceTransDTO> >(x => x.Get_Edit_List_Trans(oRow.RecId));
                CTransactionsDTO             cTransactions = _currentTransactionsList.FirstOrDefault(x => x.CurID == oRow.CariRecId);
                List <ReportInvoiceTransDTO> reportTrans   = new List <ReportInvoiceTransDTO>();
                foreach (var item in trans)
                {
                    reportTrans.Add(new ReportInvoiceTransDTO
                    {
                        ProductName = AppMain.Products.FirstOrDefault(x => x.PID == item.ProductId).PName,
                        Tutar       = item.Tutar,
                        Unit        = item.Quentity + " " + _list_UnitsDTO.FirstOrDefault(x => x.UID == item.UnitID.GetValueOrDefault()).UName,
                        PTax        = item.KDVPrice
                    });
                }

                ReportInvoice reportInvoice = new ReportInvoice
                {
                    CustomerName    = cTransactions.CurAccountName,
                    CustomerAddress = cTransactions.CurAdress,
                    CustomerCity    = cTransactions.CurCity,
                    CustomerCountry = cTransactions.CurCountryName,
                    FaturaNo        = oRow.FicheDocumentNo,
                    FichDate        = oRow.FicDate.GetValueOrDefault(),
                    InvoiceType     = oRow.InvoiceType.GetValueOrDefault(),
                    trans           = reportTrans
                };


                frmPrint frm = new frmPrint();
                frm.PrintInvoiceReport(oRow, reportTrans, cTransactions, reportInvoice);
                frm.ShowDialog();
            }
        }