Exemple #1
0
 public Report(ReprotTransactionLines transactionLines)
 {
     this.TransactionLines = transactionLines;
     InitializeComponent();
     init();
     this.dataGridViewReport.DataSource = this.TransactionLines;
 }
Exemple #2
0
        void loadReport(DateTime?FromDate, DateTime?ToDate, string ItemCode)
        {
            FromDate = FromDate ?? DateTime.MinValue;
            ToDate   = ToDate ?? DateTime.Now;
            ItemCode = string.IsNullOrEmpty(ItemCode) ? "" : ItemCode;
            SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder();

            builder.DataSource     = SettingsProvider.GetDataSource();
            builder.InitialCatalog = SettingsProvider.GetDatabase();
            builder.UserID         = SettingsProvider.GetUserName();
            builder.Password       = SettingsProvider.GetPassword();

            int type               = 2;
            int entryStatus        = 0;
            int transactionStatus  = 0;
            int defaultAddressType = 0;

            using (DelivaryDataProvider db = new DelivaryDataProvider(builder.ConnectionString))
            {
                List <DelivaryTransactionView> result = db.getDelivaryTransactionView();

                var transactionLine = from x in result
                                      select
                                      new ReportTransactionLine()
                {
                    ReceiptID      = x.RECEIPTID,
                    ItemId         = x.ITEMID,
                    Description    = x.DESCRIPTION,
                    Qty            = x.QUANTITY == null?0:(decimal)x.QUANTITY,
                    TaxInckInPrice = x.SEIINGPRICE == null ? 0 : (decimal)x.SEIINGPRICE,
                    Comment        = x.COMMENT.Replace("\r\n", " "),
                    ExtraInfo      = x.DELIVARYTYPE
                    , CustomerName = x.NAME
                };
                this.TransactionLines = transactionLine.Count() > 0 ? new ReprotTransactionLines(transactionLine.ToList()) : null;
            }

            /*
             *  using (var db = new DeliveryDbContext(builder.ConnectionString))
             * {   //LINENUM changed to LINEID IN in line 103 col 155 by rafeeq
             *
             *  var transactionCustomer = from tra_h in db.RBOTRANSACTIONTABLE
             *                            join tra_i in db.RBOTRANSACTIONINFOCODETRANS
             *                            on
             *                            new { tra_h.TRANSACTIONID, INFOCODEID =  } equals new { tra_i.TRANSACTIONID, tra_i.INFOCODEID } into info_d
             *                            from info in info_d.DefaultIfEmpty()
             *                            join cust in db.CUSTTABLE on new { CUSTACCOUNT = string.IsNullOrEmpty(info.INFORMATION) ? tra_h.CUSTACCOUNT : info.INFORMATION } equals
             *                            new { CUSTACCOUNT = cust.ACCOUNTNUM }
             *                            join address in db.CUSTOMERADDRESS on
             *                            new { cust.ACCOUNTNUM, ADDRESSTYPE = defaultAddressType } equals new { address.ACCOUNTNUM, address.ADDRESSTYPE }
             *                            where
             *                              tra_h.TYPE == type &&
             *                              tra_h.ENTRYSTATUS == entryStatus
             *                            select new TransactionCustomer()
             *                            {
             *                                ReceiptID = tra_h.RECEIPTID,
             *                                CustAccount = string.IsNullOrEmpty(info.INFORMATION) ? tra_h.CUSTACCOUNT : info.INFORMATION,
             *                                Name = cust.NAME,
             *                                Address = cust.ADDRESS,
             *                                Phone = cust.PHONE,
             *                                Address1 = address.ADDRESS,
             *                                Street = address.STREET
             *                            };
             *  var transactionLine = from tra_h in db.RBOTRANSACTIONTABLE
             *                        join tra_l in db.RBOTRANSACTIONSALESTRANS
             *                        on tra_h.TRANSACTIONID equals tra_l.TRANSACTIONID
             *                        join tra_i in db.RBOTRANSACTIONINFOCODETRANS
             *                        on
             *                        new { tra_l.TRANSACTIONID, tra_l.LINENUM, INFOCODEID = Program.isDelevary } equals new { tra_i.TRANSACTIONID, LINENUM = (decimal)tra_i.LINEID, tra_i.INFOCODEID } into info_d
             *                        from info in info_d.DefaultIfEmpty()
             *                        join info_sub in db.RBOINFORMATIONSUBCODETABLE on
             *                        info.INFORMATION equals info_sub.SUBCODEID into info_sub_d
             *                        from info_s in info_sub_d.DefaultIfEmpty()
             *                        where
             *                          tra_h.TYPE == type &&
             *                          tra_h.ENTRYSTATUS == entryStatus &&
             *                          tra_l.TRANSACTIONSTATUS == transactionStatus &&
             *                          info_s.DESCRIPTION == Program.isDelevaryValue &&
             *                          tra_h.TRANSDATE < ToDate &&
             *                          tra_h.TRANSDATE > FromDate &&
             *                          tra_l.ITEMID.StartsWith(ItemCode)
             *                        select new TransactionLine()
             *                        {
             *                            ReceiptID = tra_h.RECEIPTID,
             *                            ItemId = tra_l.ITEMID,
             *                            Description = tra_l.DESCRIPTION,
             *                            Qty = (tra_l.QTY ?? 0) * -1,
             *                            TaxInckInPrice = -1 * (tra_l.NETAMOUNTINCLTAX ?? 0),
             *                            Comment = tra_l.COMMENT,
             *                            ExtraInfo = string.IsNullOrEmpty(info_s.DESCRIPTION) ? "NON DELIVERABLE" : info_s.DESCRIPTION
             *                        };
             *
             *  this.TransactionLines = transactionLine.Count() > 0 ? new TransactionLines(transactionLine.ToList()) : null;
             * }
             */
        }