Esempio n. 1
0
        public static ReportDocument LoadInventoryAdjustmentList(DateTime date1, DateTime date2)
        {
            ReportDocument rpt = new Inventory.rprInventoryAdjustmentList();
            dsReports      ds  = new dsReports();

            ds.EnforceConstraints = false;

            DenormalizedOrdersTableAdapter ta = new DenormalizedOrdersTableAdapter();

            ta.ClearBeforeFill = true;
            ta.Connection      = AppHelper.GetDbConnection();
            ta.FillInventoryAdjustments(ds.DenormalizedOrders, date1, date2);

            if (ds.DenormalizedOrders.Rows.Count <= 0)
            {
                FillNoData(ds.DenormalizedOrders);
            }

            RetrieveDeveloper(ds.Developer);
            RetrieveOwner(ds.Owner);
            rpt.SetDataSource(ds);
            rpt.ParameterFields["@Date1"].CurrentValues.AddValue(date1);
            rpt.ParameterFields["@Date2"].CurrentValues.AddValue(date2);
            return(rpt);
        }
Esempio n. 2
0
        private static void RetrieveOwner(dsReports.OwnerDataTable dt)
        {
            OwnerTableAdapter ow = new OwnerTableAdapter();
            ow.ClearBeforeFill = true;
            ow.Connection = AppHelper.GetDbConnection();
            ow.FillOwner(dt);

        }
Esempio n. 3
0
        public override global::System.Data.DataSet Clone()
        {
            dsReports cln = ((dsReports)(base.Clone()));

            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return(cln);
        }
Esempio n. 4
0
 private static void FillNoData(dsReports.DenormalizedOrdersDataTable dt)
 {
     dsReports.DenormalizedOrdersRow row = dt.NewDenormalizedOrdersRow();
     row.OrderNo = "NO DATA AVAILABLE";
     row.Remarks = "NO DATA AVAILABLE";
     row.CompanyName = "NO DATA AVAILABLE";
     row.DetailRemarks = "NO DATA AVAILABLE";
     row.OrderDate = DateTime.Today;
     dt.AddDenormalizedOrdersRow(row);
 }
Esempio n. 5
0
        public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs)
        {
            dsReports ds = new dsReports();

            global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
            global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
            global::System.Xml.Schema.XmlSchemaAny         any      = new global::System.Xml.Schema.XmlSchemaAny();
            any.Namespace = ds.Namespace;
            sequence.Items.Add(any);
            type.Particle = sequence;
            global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
            if (xs.Contains(dsSchema.TargetNamespace))
            {
                global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                try {
                    global::System.Xml.Schema.XmlSchema schema = null;
                    dsSchema.Write(s1);
                    for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                    {
                        schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                        s2.SetLength(0);
                        schema.Write(s2);
                        if ((s1.Length == s2.Length))
                        {
                            s1.Position = 0;
                            s2.Position = 0;
                            for (; ((s1.Position != s1.Length) &&
                                    (s1.ReadByte() == s2.ReadByte()));)
                            {
                                ;
                            }
                            if ((s1.Position == s1.Length))
                            {
                                return(type);
                            }
                        }
                    }
                }
                finally {
                    if ((s1 != null))
                    {
                        s1.Close();
                    }
                    if ((s2 != null))
                    {
                        s2.Close();
                    }
                }
            }
            xs.Add(dsSchema);
            return(type);
        }
Esempio n. 6
0
 private static void RetrieveDeveloper(dsReports.DeveloperDataTable dt)
 {
     dsReports.DeveloperRow row = dt.NewDeveloperRow();
     row.Code = "DEVELOPER";
     row.Type = "D";
     row.Active = true;
     row.Name = Application.CompanyName;
     row.Industry = Application.ProductName;
     row.Website = "http://www.Biruniech.com/";
     row.BillingContactPerson = AppHelper.appUserName;
     row.BillingContactPhone = AppHelper.appRoleName;
     dt.AddDeveloperRow(row);
 }
        public ActionResult Inventory(DateTime?DateFrom, DateTime?DateTo)
        {
            ReportViewer     reportViewer = new ReportViewer();
            ReportDataSource rds          = new ReportDataSource();
            dsReports        _dsrep       = new dsReports();

            reportViewer.ProcessingMode      = ProcessingMode.Local;
            reportViewer.SizeToReportContent = true;
            reportViewer.Width  = Unit.Percentage(100);
            reportViewer.Height = Unit.Percentage(100);

            if (DateFrom != null && DateTo != null)
            {
                rds.Name = "Inventory";
                //var x = db.MedChecks.Include(a => a.MedCheckItems).Include(a => a.Patient).Include(a => a.Staff);
                var x = db.MedCheckItems.Include(a => a.MedCheck).Include(a => a.Item).Where(a => a.MedCheck.DateTimeOfVisit >= DateFrom && a.MedCheck.DateTimeOfVisit <= DateTo);
                foreach (var item in x)
                {
                    var medStaff   = db.Staffs.Where(a => a.StaffID == item.MedCheck.StaffID).FirstOrDefault();
                    var medPatient = db.Patients.Where(a => a.PatientID == item.MedCheck.PatientID).FirstOrDefault();

                    _dsrep.Inventory.AddInventoryRow(item.Item.ItemName, medStaff.StaffFirst + " " + medStaff.StaffLast, medPatient.PatientFirst + " " + medPatient.PatientLast, item.MedCheck.DateTimeOfVisit.ToShortDateString(), item.MedCheck.MedCheckItems.FirstOrDefault().Quantity.ToString());
                }

                rds.Value = _dsrep.Inventory;
                reportViewer.LocalReport.DataSources.Clear();
                reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"Views\Reports\Inventory.rdlc";

                ReportParameter[] _parameter = new ReportParameter[2];
                _parameter[0] = new ReportParameter("DateFrom", DateFrom.Value.ToShortDateString());
                _parameter[1] = new ReportParameter("DateTo", DateTo.Value.ToShortDateString());

                reportViewer.LocalReport.SetParameters(_parameter);
                reportViewer.LocalReport.DataSources.Add(rds);
                reportViewer.LocalReport.Refresh();
                ViewBag.ReportViewer = reportViewer;
                return(View());
            }

            rds.Name = "Inventory";

            reportViewer.LocalReport.DataSources.Clear();
            reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"Views\Reports\Inventory.rdlc";
            rds.Value = _dsrep.Inventory;
            reportViewer.LocalReport.DataSources.Add(rds);
            reportViewer.LocalReport.Refresh();
            ViewBag.ReportViewer = reportViewer;

            return(View());
        }
        public ActionResult Clearance_Med(int?PatientName)
        {
            string staff   = Session["staffid"].ToString();
            var    patient = db.Patients
                             .Select(s => new
            {
                Text  = s.PatientFirst + " " + s.PatientMid + " " + s.PatientLast,
                Value = s.PatientID
            })
                             .ToList();

            ViewBag.ddlPatient = new SelectList(patient, "Value", "Text");

            ReportViewer reportViewer = new ReportViewer();
            dsReports    _dsrep       = new dsReports();

            reportViewer.ProcessingMode      = ProcessingMode.Local;
            reportViewer.SizeToReportContent = true;
            reportViewer.Width  = Unit.Percentage(75);
            reportViewer.Height = Unit.Percentage(100);

            var name      = db.Patients.FirstOrDefault(b => b.PatientID == b.PatientID);
            var staffName = db.Staffs.Find(staff);

            if (PatientName != null)
            {
                reportViewer.LocalReport.DataSources.Clear();
                reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"Views\Reports\Clearance_Med.rdlc";

                ReportParameter[] _parameter = new ReportParameter[3];
                _parameter[0] = new ReportParameter("PatientName", name.PatientFirst + " " + name.PatientMid + " " + name.PatientLast);
                _parameter[1] = new ReportParameter("Examiner", staffName.StaffFirst + " " + staffName.StaffLast);
                _parameter[2] = new ReportParameter("IssuedDate", DateTime.Now.ToShortDateString());

                reportViewer.LocalReport.SetParameters(_parameter);
                reportViewer.LocalReport.Refresh();
                ViewBag.ReportViewer = reportViewer;

                return(View());
            }


            reportViewer.LocalReport.DataSources.Clear();
            reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"Views\Reports\Clearance_Med.rdlc";
            reportViewer.LocalReport.Refresh();
            ViewBag.ReportViewer = reportViewer;

            return(View());
        }
Esempio n. 9
0
        private void PrintPreview()
        {
            try
            {
                using (var uow = new UnitOfWork(new DataContext()))
                {
                    var     products     = Factories.CreateProducts().GetProductList("");
                    var     ds           = new dsReports();
                    var     productTable = ds.Tables["Product"];
                    DataRow productRow;
                    int     p_count = 0;
                    foreach (var item in products)
                    {
                        p_count++;
                        productRow                 = productTable.NewRow();
                        productRow["i"]            = p_count.ToString();
                        productRow["Name"]         = item.Description;
                        productRow["SupplierName"] = item.SupplierName;
                        productRow["Price"]        = item.Price;
                        productRow["Quantity"]     = item.Quantity;
                        productRow["Limit"]        = item.Limit;
                        productTable.Rows.Add(productRow);
                    }

                    var p_dateNow = new ReportParameter("DateNow", DateTime.Now.ToLongDateString());


                    this.rptReport.LocalReport.SetParameters(new ReportParameter[] {
                        p_dateNow
                    });
                    var productRDS = new ReportDataSource("Product", productTable);
                    rptReport.LocalReport.DataSources.Clear();
                    rptReport.LocalReport.DataSources.Add(productRDS);


                    rptReport.SetDisplayMode(DisplayMode.PrintLayout);
                    rptReport.ZoomMode = ZoomMode.PageWidth;
                    this.rptReport.RefreshReport();
                }
            }
            catch (Exception ex)
            {
                LocalUtils.ShowErrorMessage(this, ex.ToString());
            }
        }
Esempio n. 10
0
        public static ReportDocument LoadInventoryStatus()
        {
            ReportDocument rpt = new Inventory.rptInventoryStatus();
            dsReports      ds  = new dsReports();

            ds.EnforceConstraints = false;

            InventoryStatusTableAdapter ta = new InventoryStatusTableAdapter();

            ta.ClearBeforeFill = true;
            ta.Connection      = AppHelper.GetDbConnection();
            ta.FillDenormalized(ds.InventoryStatus);

            RetrieveDeveloper(ds.Developer);
            RetrieveOwner(ds.Owner);
            rpt.SetDataSource(ds);
            return(rpt);
        }
Esempio n. 11
0
        public static ReportDocument LoadDeliveryOrderForm(string code)
        {
            ReportDocument rpt = new Forms.rptDeliveryOrderForm();
            dsReports ds = new dsReports();

            DenormalizedOrdersTableAdapter ta = new DenormalizedOrdersTableAdapter();
            ta.ClearBeforeFill = true;
            ta.Connection = AppHelper.GetDbConnection();
            ta.FillByOrderNo(ds.DenormalizedOrders, code, TransactionTypes.TX_DELIVERY_ORDER);

            if (ds.DenormalizedOrders.Rows.Count <= 0)
                FillNoData(ds.DenormalizedOrders);

            RetrieveDeveloper(ds.Developer);
            RetrieveOwner(ds.Owner);
            rpt.SetDataSource(ds);
            return rpt;
        }
Esempio n. 12
0
        public static ReportDocument LoadUnitMeasureList()
        {
            ReportDocument rpt = new Master.rptUnitMeasureList();
            dsReports      ds  = new dsReports();

            ds.EnforceConstraints = false;

            UnitMeasuresTableAdapter ta = new UnitMeasuresTableAdapter();

            ta.ClearBeforeFill = true;
            ta.Connection      = AppHelper.GetDbConnection();
            ta.Fill(ds.UnitMeasures);

            RetrieveDeveloper(ds.Developer);
            RetrieveOwner(ds.Owner);
            rpt.SetDataSource(ds);
            return(rpt);
        }
Esempio n. 13
0
        public static ReportDocument LoadDeliveryOrderForm(int id)
        {
            ReportDocument rpt = new Forms.rptDeliveryOrderForm();
            dsReports ds = new dsReports();

            DenormalizedOrdersTableAdapter ta = new DenormalizedOrdersTableAdapter();
            ta.ClearBeforeFill = true;
            ta.Connection = AppHelper.GetDbConnection();
            ta.FillByID(ds.DenormalizedOrders, id);

            if (ds.DenormalizedOrders.Rows.Count <= 0)
                FillNoData(ds.DenormalizedOrders);

            RetrieveDeveloper(ds.Developer);
            RetrieveOwner(ds.Owner);
            rpt.SetDataSource(ds);
            return rpt;
        }
Esempio n. 14
0
        public static ReportDocument LoadDeliveryOrderForm(string code)
        {
            ReportDocument rpt = new Forms.rptDeliveryOrderForm();
            dsReports      ds  = new dsReports();

            DenormalizedOrdersTableAdapter ta = new DenormalizedOrdersTableAdapter();

            ta.ClearBeforeFill = true;
            ta.Connection      = AppHelper.GetDbConnection();
            ta.FillByOrderNo(ds.DenormalizedOrders, code, TransactionTypes.TX_DELIVERY_ORDER);

            if (ds.DenormalizedOrders.Rows.Count <= 0)
            {
                FillNoData(ds.DenormalizedOrders);
            }

            RetrieveDeveloper(ds.Developer);
            RetrieveOwner(ds.Owner);
            rpt.SetDataSource(ds);
            return(rpt);
        }
Esempio n. 15
0
        public static ReportDocument LoadDeliveryOrderForm(int id)
        {
            ReportDocument rpt = new Forms.rptDeliveryOrderForm();
            dsReports      ds  = new dsReports();

            DenormalizedOrdersTableAdapter ta = new DenormalizedOrdersTableAdapter();

            ta.ClearBeforeFill = true;
            ta.Connection      = AppHelper.GetDbConnection();
            ta.FillByID(ds.DenormalizedOrders, id);

            if (ds.DenormalizedOrders.Rows.Count <= 0)
            {
                FillNoData(ds.DenormalizedOrders);
            }

            RetrieveDeveloper(ds.Developer);
            RetrieveOwner(ds.Owner);
            rpt.SetDataSource(ds);
            return(rpt);
        }
Esempio n. 16
0
        public static ReportDocument LoadPurchaseByVendor(DateTime date1, DateTime date2)
        {
            ReportDocument rpt = new Purchasing.rprPurchaseByVendor();
            dsReports      ds  = new dsReports();

            DenormalizedOrdersTableAdapter ta = new DenormalizedOrdersTableAdapter();

            ta.ClearBeforeFill = true;
            ta.Connection      = AppHelper.GetDbConnection();
            ta.FillByDate(ds.DenormalizedOrders, TransactionTypes.TX_PURCHASE_ORDER, date1, date2);

            if (ds.DenormalizedOrders.Rows.Count <= 0)
            {
                FillNoData(ds.DenormalizedOrders);
            }

            RetrieveDeveloper(ds.Developer);
            RetrieveOwner(ds.Owner);
            rpt.SetDataSource(ds);
            rpt.ParameterFields["@Date1"].CurrentValues.AddValue(date1);
            rpt.ParameterFields["@Date2"].CurrentValues.AddValue(date2);
            return(rpt);
        }
Esempio n. 17
0
        public static ReportDocument LoadSalesOutstanding(DateTime date1, DateTime date2)
        {
            ReportDocument rpt = new Sales.rprBackOrders();
            dsReports      ds  = new dsReports();

            DenormalizedOrdersTableAdapter ta = new DenormalizedOrdersTableAdapter();

            ta.ClearBeforeFill = true;
            ta.Connection      = AppHelper.GetDbConnection();
            ta.FillNotCompleted(ds.DenormalizedOrders, TransactionTypes.TX_SALES_ORDER, date1, date2);

            if (ds.DenormalizedOrders.Rows.Count <= 0)
            {
                FillNoData(ds.DenormalizedOrders);
            }

            RetrieveDeveloper(ds.Developer);
            RetrieveOwner(ds.Owner);
            rpt.SetDataSource(ds);
            rpt.ParameterFields["@Date1"].CurrentValues.AddValue(date1);
            rpt.ParameterFields["@Date2"].CurrentValues.AddValue(date2);
            return(rpt);
        }
Esempio n. 18
0
        public static ReportDocument LoadInventoryMutation(int id)
        {
            ReportDocument rpt = new Inventory.rprInventoryMutation();
            dsReports      ds  = new dsReports();

            ds.EnforceConstraints = false;

            DenormalizedOrdersTableAdapter ta = new DenormalizedOrdersTableAdapter();

            ta.ClearBeforeFill = true;
            ta.Connection      = AppHelper.GetDbConnection();
            ta.FillByItemID(ds.DenormalizedOrders, id);

            if (ds.DenormalizedOrders.Rows.Count <= 0)
            {
                FillNoData(ds.DenormalizedOrders);
            }

            RetrieveDeveloper(ds.Developer);
            RetrieveOwner(ds.Owner);
            rpt.SetDataSource(ds);
            return(rpt);
        }
Esempio n. 19
0
        public static ReportDocument LoadInventoryStatus()
        {
            ReportDocument rpt = new Inventory.rptInventoryStatus();
            dsReports ds = new dsReports();
            ds.EnforceConstraints = false;

            InventoryStatusTableAdapter ta = new InventoryStatusTableAdapter();
            ta.ClearBeforeFill = true;
            ta.Connection = AppHelper.GetDbConnection();
            ta.FillDenormalized(ds.InventoryStatus);

            RetrieveDeveloper(ds.Developer);
            RetrieveOwner(ds.Owner);
            rpt.SetDataSource(ds);
            return rpt;
        }
Esempio n. 20
0
        public static ReportDocument LoadSalesOutstanding(DateTime date1, DateTime date2)
        {
            ReportDocument rpt = new Sales.rprBackOrders();
            dsReports ds = new dsReports();

            DenormalizedOrdersTableAdapter ta = new DenormalizedOrdersTableAdapter();
            ta.ClearBeforeFill = true;
            ta.Connection = AppHelper.GetDbConnection();
            ta.FillNotCompleted(ds.DenormalizedOrders, TransactionTypes.TX_SALES_ORDER, date1, date2);

            if (ds.DenormalizedOrders.Rows.Count <= 0)
                FillNoData(ds.DenormalizedOrders);

            RetrieveDeveloper(ds.Developer);
            RetrieveOwner(ds.Owner);
            rpt.SetDataSource(ds);
            rpt.ParameterFields["@Date1"].CurrentValues.AddValue(date1);
            rpt.ParameterFields["@Date2"].CurrentValues.AddValue(date2);
            return rpt;
        }
Esempio n. 21
0
        public static ReportDocument LoadPurchaseByVendor(DateTime date1, DateTime date2)
        {
            ReportDocument rpt = new Purchasing.rprPurchaseByVendor();
            dsReports ds = new dsReports();

            DenormalizedOrdersTableAdapter ta = new DenormalizedOrdersTableAdapter();
            ta.ClearBeforeFill = true;
            ta.Connection = AppHelper.GetDbConnection();
            ta.FillByDate(ds.DenormalizedOrders, TransactionTypes.TX_PURCHASE_ORDER, date1, date2);

            if (ds.DenormalizedOrders.Rows.Count <= 0)
                FillNoData(ds.DenormalizedOrders);

            RetrieveDeveloper(ds.Developer);
            RetrieveOwner(ds.Owner);
            rpt.SetDataSource(ds);
            rpt.ParameterFields["@Date1"].CurrentValues.AddValue(date1);
            rpt.ParameterFields["@Date2"].CurrentValues.AddValue(date2);
            return rpt;
        }
        async void LoadPreviousTransactionReport()
        {
            try
            {
                var criteria = txtSearch.Text;
                var dateFrom = DateTime.Now;
                var dateTo   = DateTime.Now;

                await Task.Delay(1000);

                List <PreviousTransactionListModel> prevTransactions = new List <PreviousTransactionListModel>();
                if (radioDailySales.Checked)
                {
                    // range filter selected
                    prevTransactions = await Task.Run(() => Factories.CreatePosTransaction().GetDailyTransactions(criteria));
                }
                else if (radioWeeklySales.Checked)
                {
                    dateFrom         = DateTime.Now.StartOfWeek(DayOfWeek.Monday);
                    dateTo           = dateFrom.AddDays(6);
                    prevTransactions = await Task.Run(() => Factories.CreatePosTransaction().GetWeeklyTransactions(criteria));
                }
                else if (radioMonthlySales.Checked)
                {
                    dateFrom         = DateTime.Now.FirstDayOfMonth();
                    dateTo           = DateTime.Now.LastDayOfMonth();
                    prevTransactions = await Task.Run(() => Factories.CreatePosTransaction().GetMonthlyTransactions(criteria));
                }
                else
                {
                    dateFrom = dtDateFrom.Value;
                    dateTo   = dtDateTo.Value;
                    // range filter selected
                    prevTransactions = await Task.Run(() => Factories.CreatePosTransaction().GetTransactions(criteria, dateFrom, dateTo));
                }
                int count = 0;

                var       ds = new dsReports();
                DataTable t  = ds.Tables["dtPosTransaction"];
                DataRow   r;
                foreach (var item in prevTransactions)
                {
                    count++;
                    r                    = t.NewRow();
                    r["i"]               = count.ToString();
                    r["Date"]            = item.Date;
                    r["TransactionCode"] = item.TransactionCode;
                    r["Quantity"]        = item.Quantity;
                    r["AmountTendered"]  = item.AmountTendered;
                    r["Total"]           = item.Total;

                    t.Rows.Add(r);
                }
                rptViewer.LocalReport.DataSources.Clear();
                ReportDataSource rds = new ReportDataSource("dsPosTransaction", t);

                var p_datefrom = new ReportParameter("DateFrom", dateFrom.ToShortDateString());
                var p_dateTo   = new ReportParameter("DateTo", dateTo.ToShortDateString());

                rptViewer.LocalReport.SetParameters(new ReportParameter[] { p_datefrom, p_dateTo });

                rptViewer.LocalReport.DataSources.Add(rds);
                rptViewer.SetDisplayMode(DisplayMode.PrintLayout);
                rptViewer.ZoomMode = ZoomMode.PageWidth;
                this.rptViewer.RefreshReport();
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 23
0
        private void PrintReciept()
        {
            try
            {
                if (_postTransactionID > 0)
                {
                    using (var uow = new UnitOfWork(new DataContext()))
                    {
                        var       posProductTransactions = uow.PosTransactionProducts.GetAllBy(_postTransactionID);
                        var       posTransaction         = uow.PosTransaction.GetPosTransaction(_postTransactionID);
                        dsReports ds = new dsReports();
                        DataTable t  = ds.Tables["dsReciept"];
                        DataRow   r;
                        int       count = 0;
                        foreach (var item in posProductTransactions)
                        {
                            count++;
                            r             = t.NewRow();
                            r["ID"]       = count.ToString();
                            r["Quantity"] = item.Quantity.ToString();
                            r["Item"]     = item.Product.Description;
                            r["Price"]    = item.Product.Price;
                            r["Total"]    = item.Quantity * item.Product.Price;
                            t.Rows.Add(r);
                        }

                        LocalReport report = new LocalReport();
                        string      path   = Path.GetDirectoryName(Application.ExecutablePath);
                        //string fullPath = path.Remove(path.Length - 10) + @"\Reports\Reciept.rdlc";
                        string fullPath = path + @"\Reports\Reciept.rdlc";
                        report.ReportPath = fullPath;
                        report.DataSources.Add(new ReportDataSource("dsReciept", t));
                        var paramDate    = new ReportParameter("date", DateTime.Now.ToShortDateString());
                        var p_time       = new ReportParameter("time", DateTime.Now.ToShortTimeString());
                        var paramTotal   = new ReportParameter("totalAmount", txtTotal.Text);
                        var paramCash    = new ReportParameter("cash", posTransaction.AmountTender.Value.ToString());
                        var paramChange  = new ReportParameter("change", txtChange.Text);
                        var p_cashier    = new ReportParameter("cashier", CurrentUser.Name);
                        var p_transcCode = new ReportParameter("transCode", posTransaction.TransactionCode);
                        report.SetParameters(new ReportParameter[] { paramDate, p_time, paramTotal, paramCash, paramChange, p_cashier, p_transcCode });
                        PrintToPrinter(report);



                        //    rptViewer.LocalReport.DataSources.Clear();
                        //    ReportDataSource rds = new ReportDataSource("PrevPrenatalRecord", t);
                        //    ReportDataSource rds2 = new ReportDataSource("PresPrenatalRecord", t2);


                        //    ReportParameter p_age = new ReportParameter("Age", txtAge.Text);
                        //    ReportParameter p_weight = new ReportParameter("Weight", txtWeight.Text);
                        //    ReportParameter p_height = new ReportParameter("Height", txtHeight.Text);
                        //    ReportParameter p_bmi = new ReportParameter("BMI", txtBMI.Text);
                        //    ReportParameter p_lastMensDate = new ReportParameter("LastMensDate", txtLastMens.Text);
                        //    ReportParameter p_expDeliveryDate = new ReportParameter("ExpDeliveryDate", txtExpectedDelivery.Text);

                        //    ReportParameter p_prenatalMonthCount = new ReportParameter("PrenatalMonthCount", txtMonthCount.Text);
                        //    ReportParameter p_prenatalCount = new ReportParameter("PrenatalCount", txtPregnancyCount.Text);

                        //    this.rptViewer.LocalReport.SetParameters(new ReportParameter[]
                        //{ p_age,
                        //p_weight,
                        //p_height,
                        //p_bmi,
                        //p_lastMensDate,
                        //p_expDeliveryDate,
                        //p_prenatalMonthCount,
                        //p_prenatalCount
                        //});
                        //    var currentRec = uow.PrenatalRecords.Get(prenatalRecID);
                        //    rptViewer.LocalReport.DataSources.Add(rds);
                        //    rptViewer.LocalReport.DataSources.Add(rds2);
                        //    rptViewer.SetDisplayMode(DisplayMode.PrintLayout);
                        //    rptViewer.ZoomMode = ZoomMode.PageWidth;
                        //    rptViewer.LocalReport.DisplayName = currentRec.FullName;
                        //    this.rptViewer.RefreshReport();
                    }
                }
                else
                {
                    MetroMessageBox.Show(this, "No Transaction Reciept to print!", "Print Reciept", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                LocalUtils.ShowErrorMessage(this, ex.ToString());
            }
        }
Esempio n. 24
0
            public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs)
            {
                global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
                global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
                dsReports ds = new dsReports();

                global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
                any1.Namespace       = "http://www.w3.org/2001/XMLSchema";
                any1.MinOccurs       = new decimal(0);
                any1.MaxOccurs       = decimal.MaxValue;
                any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any1);
                global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
                any2.Namespace       = "urn:schemas-microsoft-com:xml-diffgram-v1";
                any2.MinOccurs       = new decimal(1);
                any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any2);
                global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute1.Name       = "namespace";
                attribute1.FixedValue = ds.Namespace;
                type.Attributes.Add(attribute1);
                global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute2.Name       = "tableTypeName";
                attribute2.FixedValue = "dtVoucharDataTable";
                type.Attributes.Add(attribute2);
                type.Particle = sequence;
                global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
                if (xs.Contains(dsSchema.TargetNamespace))
                {
                    global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                    global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                    try {
                        global::System.Xml.Schema.XmlSchema schema = null;
                        dsSchema.Write(s1);
                        for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                        {
                            schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                            s2.SetLength(0);
                            schema.Write(s2);
                            if ((s1.Length == s2.Length))
                            {
                                s1.Position = 0;
                                s2.Position = 0;
                                for (; ((s1.Position != s1.Length) &&
                                        (s1.ReadByte() == s2.ReadByte()));)
                                {
                                    ;
                                }
                                if ((s1.Position == s1.Length))
                                {
                                    return(type);
                                }
                            }
                        }
                    }
                    finally {
                        if ((s1 != null))
                        {
                            s1.Close();
                        }
                        if ((s2 != null))
                        {
                            s2.Close();
                        }
                    }
                }
                xs.Add(dsSchema);
                return(type);
            }
Esempio n. 25
0
        private void frmPrintPreView_Load(object sender, EventArgs e)
        {
            DataTable zag    = new DataTable();
            DataTable zagour = new DataTable();

            if (callType != 5)
            {
                zag = proc.GetPrintTitle(id);
                if (zag == null || zag.Rows.Count == 0)
                {
                    MessageBox.Show("Не удалось получить заголовок накладной!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                zagour = proc.GetOurOrg((DateTime)zag.Rows[0]["dprihod"], int.Parse(zag.Rows[0]["ntypeorg"].ToString()));
            }

            #region накладная прихода
            if (nakl && callType == 1)
            {
                dsReports ds = new dsReports();

                DataTable temp = proc.GetPrintedPrih(id);

                int page = 1;

                for (int i = 0; i < temp.Rows.Count; i++)
                {
                    if ((page == 1 &&
                         i == 8) ||
                        (System.Data.SqlTypes.SqlInt32.Mod(i - 7, 17) == 1 && page != 1))
                    {
                        page++;
                    }
                    ds.Tables["dtNakl"].Rows.Add(temp.Rows[i]["npp"].ToString().Trim()
                                                 , temp.Rows[i]["cname"].ToString().Trim()
                                                 , temp.Rows[i]["cunit"].ToString().Trim()
                                                 , decimal.Parse(temp.Rows[i]["netto"].ToString()).ToString("N3")
                                                 , ((decimal)temp.Rows[i]["zcena"]).ToString("N2")
                                                 , ((decimal)temp.Rows[i]["sum"]).ToString("N2")
                                                 , temp.Rows[i]["nds"].ToString().Trim()
                                                 , ((decimal)temp.Rows[i]["sumnds"]).ToString("N2")
                                                 , decimal.Parse(temp.Rows[i]["sumwnds"].ToString())
                                                 , page);
                }

                crNaklmain reportNakl = new crNaklmain();
                string     Gruzootpr  = zag.Rows[0]["cname"].ToString().Trim() + ", ИНН " + zag.Rows[0]["inn"].ToString().Trim()
                                        + ", " + zag.Rows[0]["adressP"].ToString().Trim();
                string GruzoPoluch = zagour.Rows[0]["cname"].ToString().Trim() + ", " + zagour.Rows[0]["inn"].ToString().Trim()
                                     + ", " + zagour.Rows[0]["adressP"].ToString().Trim();
                string Plat = zagour.Rows[0]["cname"].ToString().Trim() + ", ИНН " + zagour.Rows[0]["inn"].ToString().Trim()
                              + ", КПП " + zagour.Rows[0]["kpp"].ToString().Trim() + ", " + zagour.Rows[0]["adressU"].ToString().Trim()
                              + ", Р/сч " + zagour.Rows[0]["rsch"].ToString().Trim() + ", " + zagour.Rows[0]["bank"].ToString().Trim()
                              + ", БИК " + zagour.Rows[0]["bic"].ToString().Trim()
                              + ", Корр/сч " + zagour.Rows[0]["ksch"].ToString().Trim();
                string Post = zag.Rows[0]["cname"].ToString().Trim() + ", ИНН " + zag.Rows[0]["inn"].ToString().Trim()
                              + ", КПП " + zag.Rows[0]["kpp"].ToString().Trim() + ", " + zag.Rows[0]["adressU"].ToString().Trim()
                              + ", Р/сч " + zag.Rows[0]["rsch"].ToString().Trim() + ", " + zag.Rows[0]["bank"].ToString().Trim()
                              + ", БИК " + zag.Rows[0]["bic"].ToString().Trim()
                              + ", Корр/сч " + zag.Rows[0]["ksch"].ToString().Trim();

                reportNakl.DataDefinition.FormulaFields["ttn"].Text   = "\"" + zag.Rows[0]["ttn"].ToString().Trim() + "\"";
                reportNakl.DataDefinition.FormulaFields["date"].Text  = "\"" + ((DateTime)zag.Rows[0]["dprihod"]).ToShortDateString() + "\"";
                reportNakl.DataDefinition.FormulaFields["okpo"].Text  = "\"" + zag.Rows[0]["okpo"].ToString().Trim() + "\"";
                reportNakl.DataDefinition.FormulaFields["okpo2"].Text = "\"" + zag.Rows[0]["okpo"].ToString().Trim() + "\"";
                reportNakl.DataDefinition.FormulaFields["owner"].Text = "\"" + Gruzootpr.Replace("\"", "\'") + "\"";
                reportNakl.DataDefinition.FormulaFields["gruz"].Text  = "\"" + GruzoPoluch.Replace("\"", "\'") + "\"";
                reportNakl.DataDefinition.FormulaFields["post"].Text  = "\"" + Post.Replace("\"", "\'") + "\"";
                reportNakl.DataDefinition.FormulaFields["plat"].Text  = "\"" + Plat.Replace("\"", "\'") + "\"";

                decimal x = decimal.Round(Convert.ToDecimal(temp.Compute("SUM(sumwnds)", "")), 3);
                reportNakl.DataDefinition.FormulaFields["sum"].Text      = "\"" + Conv.GetDecimalToString(x, true, false, false) + "\"";
                reportNakl.DataDefinition.FormulaFields["rukov"].Text    = "\"" + zag.Rows[0]["rukov"].ToString().Trim().Replace("\"", "\'") + "\"";
                reportNakl.DataDefinition.FormulaFields["glavbuh"].Text  = "\"" + zag.Rows[0]["glavbuh"].ToString().Trim().Replace("\"", "\'") + "\"";
                reportNakl.DataDefinition.FormulaFields["primech1"].Text = "\"" + zag.Rows[0]["comment"].ToString().Trim().Replace("\"", "\'") + "\"";
                reportNakl.DataDefinition.FormulaFields["primech2"].Text = "\"" + zag.Rows[0]["comment"].ToString().Trim().Replace("\"", "\'") + "\"";

                reportNakl.SetDataSource(ds);
                crvReport.ReportSource = reportNakl;
            }
            #endregion

            #region Накладная отгрузки
            if (nakl && callType == 2)
            {
                dsReports ds = new dsReports();

                DataTable temp = proc.GetPrintOtgruz(id);

                int page = 1;

                for (int i = 0; i < temp.Rows.Count; i++)
                {
                    if ((page == 1 &&
                         i == 8) ||
                        (System.Data.SqlTypes.SqlInt32.Mod(i - 7, 17) == 1 && page != 1))
                    {
                        page++;
                    }
                    ds.Tables["dtNakl"].Rows.Add(temp.Rows[i]["npp"].ToString().Trim()
                                                 , temp.Rows[i]["cname"].ToString().Trim()
                                                 , temp.Rows[i]["cunit"].ToString().Trim()
                                                 , temp.Rows[i]["netto"].ToString().Trim()
                                                 , ((decimal)temp.Rows[i]["zcena"]).ToString("N2")
                                                 , ((decimal)temp.Rows[i]["sum"]).ToString("N2")
                                                 , temp.Rows[i]["nds"].ToString().Trim()
                                                 , ((decimal)temp.Rows[i]["sumnds"]).ToString("N2")
                                                 , ((decimal)temp.Rows[i]["sumwnds"]).ToString("N2")
                                                 , page);
                }

                crNaklmain reportNakl  = new crNaklmain();
                string     GruzoPoluch = zag.Rows[0]["cname"].ToString().Trim() + ", ИНН " + zag.Rows[0]["inn"].ToString().Trim()
                                         + ", " + zag.Rows[0]["adressP"].ToString().Trim();
                string Gruzootpr = zagour.Rows[0]["cname"].ToString().Trim() + ", " + zagour.Rows[0]["inn"].ToString().Trim()
                                   + ", " + zagour.Rows[0]["adressP"].ToString().Trim();
                string Post = zagour.Rows[0]["cname"].ToString().Trim() + ", ИНН " + zagour.Rows[0]["inn"].ToString().Trim()
                              + ", КПП " + zagour.Rows[0]["kpp"].ToString().Trim() + ", " + zagour.Rows[0]["adressU"].ToString().Trim()
                              + ", Р/сч " + zagour.Rows[0]["rsch"].ToString().Trim() + ", " + zagour.Rows[0]["bank"].ToString().Trim()
                              + ", БИК " + zagour.Rows[0]["bic"].ToString().Trim()
                              + ", Корр/сч " + zagour.Rows[0]["ksch"].ToString().Trim();
                string Plat = zag.Rows[0]["cname"].ToString().Trim() + ", ИНН " + zag.Rows[0]["inn"].ToString().Trim()
                              + ", КПП " + zag.Rows[0]["kpp"].ToString().Trim() + ", " + zag.Rows[0]["adressU"].ToString().Trim()
                              + ", Р/сч " + zag.Rows[0]["rsch"].ToString().Trim() + ", " + zag.Rows[0]["bank"].ToString().Trim()
                              + ", БИК " + zag.Rows[0]["bic"].ToString().Trim()
                              + ", Корр/сч " + zag.Rows[0]["ksch"].ToString().Trim();

                reportNakl.DataDefinition.FormulaFields["ttn"].Text   = "\"" + zag.Rows[0]["ttn"].ToString().Trim() + "\"";
                reportNakl.DataDefinition.FormulaFields["date"].Text  = "\"" + ((DateTime)zag.Rows[0]["dprihod"]).ToShortDateString() + "\"";
                reportNakl.DataDefinition.FormulaFields["okpo"].Text  = "\"" + zagour.Rows[0]["okpo"].ToString().Trim() + "\"";
                reportNakl.DataDefinition.FormulaFields["okpo2"].Text = "\"" + zagour.Rows[0]["okpo"].ToString().Trim() + "\"";
                reportNakl.DataDefinition.FormulaFields["owner"].Text = "\"" + Gruzootpr.Replace("\"", "\'") + "\"";
                reportNakl.DataDefinition.FormulaFields["gruz"].Text  = "\"" + GruzoPoluch.Replace("\"", "\'") + "\"";
                reportNakl.DataDefinition.FormulaFields["post"].Text  = "\"" + Post.Replace("\"", "\'") + "\"";
                reportNakl.DataDefinition.FormulaFields["plat"].Text  = "\"" + Plat.Replace("\"", "\'") + "\"";
                decimal x = decimal.Round(Convert.ToDecimal(temp.Compute("SUM(sumwnds)", "")), 3);
                reportNakl.DataDefinition.FormulaFields["sum"].Text      = "\"" + Conv.GetDecimalToString(x, true, false, false) + "\"";
                reportNakl.DataDefinition.FormulaFields["rukov"].Text    = "\"" + zagour.Rows[0]["rukov"].ToString().Trim().Replace("\"", "\'") + "\"";
                reportNakl.DataDefinition.FormulaFields["glavbuh"].Text  = "\"" + zagour.Rows[0]["glavbuh"].ToString().Trim().Replace("\"", "\'") + "\"";
                reportNakl.DataDefinition.FormulaFields["primech1"].Text = "\"" + zagour.Rows[0]["comment"].ToString().Trim().Replace("\"", "\'") + "\"";
                reportNakl.DataDefinition.FormulaFields["primech2"].Text = "\"" + zagour.Rows[0]["comment"].ToString().Trim().Replace("\"", "\'") + "\"";
                reportNakl.SetDataSource(ds);
                crvReport.ReportSource = reportNakl;
            }
            #endregion

            #region счет-фактура прихода
            if (sf && callType == 1)
            {
                DataTable temp = proc.GetPrintedPrih(id);

                dsReports.dtSFDataTable sftable = new dsReports.dtSFDataTable();
                int page = 1;
                for (int i = 0; i < temp.Rows.Count; i++)
                {
                    if ((page == 1 &&
                         i == 12) ||
                        (System.Data.SqlTypes.SqlInt32.Mod(i - 11, 24) == 1 && page != 1))
                    {
                        page++;
                    }
                    sftable.AdddtSFRow(int.Parse(temp.Rows[i]["npp"].ToString())
                                       , temp.Rows[i]["cname"].ToString().Trim()
                                       , temp.Rows[i]["cunit"].ToString().Trim()
                                       , decimal.Parse(temp.Rows[i]["netto"].ToString())
                                       , decimal.Parse(temp.Rows[i]["zcena"].ToString())
                                       , decimal.Parse(temp.Rows[i]["sum"].ToString())
                                       , int.Parse(temp.Rows[i]["nds"].ToString())
                                       , decimal.Parse(temp.Rows[i]["sumnds"].ToString())
                                       , decimal.Parse(temp.Rows[i]["sumwnds"].ToString())
                                       , page);
                }

                crSF reportSF = new crSF();
                reportSF.DataDefinition.FormulaFields["ttn"].Text       = "\"" + zag.Rows[0]["SFNumber"].ToString().Trim() + " от " + ((DateTime)zag.Rows[0]["dprihod"]).ToShortDateString() + "\"";
                reportSF.DataDefinition.FormulaFields["trader"].Text    = "\"" + zag.Rows[0]["cname"].ToString().Trim().Replace("\"", "\'") + "\"";
                reportSF.DataDefinition.FormulaFields["tr_adress"].Text = "\"" + zag.Rows[0]["adressU"].ToString().Trim().Replace("\"", "\'") + "\"";
                reportSF.DataDefinition.FormulaFields["tr_inn"].Text    = "\"" + (zag.Rows[0]["inn"].ToString().Trim() + "/" + zag.Rows[0]["kpp"].ToString().Trim()).Replace("\"", "\'") + "\"";
                reportSF.DataDefinition.FormulaFields["gruz"].Text      = "\"" + (zag.Rows[0]["cname"].ToString().Trim() + ", " + zag.Rows[0]["adressP"].ToString().Trim()).Replace("\"", "\'") + "\"";
                reportSF.DataDefinition.FormulaFields["byer"].Text      = "\"" + (zagour.Rows[0]["cname"].ToString().Trim() + ", " + zagour.Rows[0]["adressP"].ToString().Trim()).Replace("\"", "\'") + "\"";
                reportSF.DataDefinition.FormulaFields["bname"].Text     = "\"" + zagour.Rows[0]["cname"].ToString().Trim().Replace("\"", "\'") + "\"";
                reportSF.DataDefinition.FormulaFields["badr"].Text      = "\"" + zagour.Rows[0]["adressU"].ToString().Trim().Replace("\"", "\'") + "\"";
                reportSF.DataDefinition.FormulaFields["binn"].Text      = "\"" + (zagour.Rows[0]["inn"].ToString().Trim() + "/" + zagour.Rows[0]["kpp"].ToString().Trim()).Replace("\"", "\'") + "\"";
                reportSF.DataDefinition.FormulaFields["rukov"].Text     = "\"" + zag.Rows[0]["rukov"].ToString().Trim().Replace("\"", "\'") + "\"";
                reportSF.DataDefinition.FormulaFields["glavbuh"].Text   = "\"" + zag.Rows[0]["glavbuh"].ToString().Trim().Replace("\"", "\'") + "\"";
                reportSF.DataDefinition.FormulaFields["primech1"].Text  = "\"" + zag.Rows[0]["comment"].ToString().Trim().Replace("\"", "\'") + "\"";
                reportSF.DataDefinition.FormulaFields["primech2"].Text  = "\"" + zag.Rows[0]["comment"].ToString().Trim().Replace("\"", "\'") + "\"";
                reportSF.SetDataSource((DataTable)sftable);
                crvReport2.ReportSource = reportSF;
            }
            #endregion

            #region счет-фактура отгрузки
            if (sf && callType == 2)
            {
                DataTable temp = proc.GetPrintOtgruz(id);

                dsReports.dtSFDataTable sftable = new dsReports.dtSFDataTable();
                int page = 1;
                for (int i = 0; i < temp.Rows.Count; i++)
                {
                    if ((page == 1 &&
                         i == 12) ||
                        (System.Data.SqlTypes.SqlInt32.Mod(i - 11, 24) == 1 && page != 1))
                    {
                        page++;
                    }

                    sftable.AdddtSFRow(int.Parse(temp.Rows[i]["npp"].ToString())
                                       , temp.Rows[i]["cname"].ToString().Trim()
                                       , temp.Rows[i]["cunit"].ToString().Trim()
                                       , decimal.Parse(temp.Rows[i]["netto"].ToString())
                                       , decimal.Parse(temp.Rows[i]["zcena"].ToString())
                                       , decimal.Parse(temp.Rows[i]["sum"].ToString())
                                       , int.Parse(temp.Rows[i]["nds"].ToString())
                                       , decimal.Parse(temp.Rows[i]["sumnds"].ToString())
                                       , decimal.Parse(temp.Rows[i]["sumwnds"].ToString())
                                       , page);
                }

                crSF reportSF = new crSF();
                reportSF.DataDefinition.FormulaFields["ttn"].Text       = "\"" + zag.Rows[0]["ttn"].ToString().Trim() + " от " + ((DateTime)zag.Rows[0]["dprihod"]).ToShortDateString() + "\"";
                reportSF.DataDefinition.FormulaFields["trader"].Text    = "\"" + zagour.Rows[0]["cname"].ToString().Trim().Replace("\"", "\'") + "\"";
                reportSF.DataDefinition.FormulaFields["tr_adress"].Text = "\"" + zagour.Rows[0]["adressU"].ToString().Trim().Replace("\"", "\'") + "\"";
                reportSF.DataDefinition.FormulaFields["tr_inn"].Text    = "\"" + (zagour.Rows[0]["inn"].ToString().Trim() + "/" + zagour.Rows[0]["kpp"].ToString().Trim()).Replace("\"", "\'") + "\"";
                reportSF.DataDefinition.FormulaFields["gruz"].Text      = "\"" + (zagour.Rows[0]["cname"].ToString().Trim() + ", " + zagour.Rows[0]["adressP"].ToString().Trim()).Replace("\"", "\'") + "\"";
                reportSF.DataDefinition.FormulaFields["byer"].Text      = "\"" + (zag.Rows[0]["cname"].ToString().Trim() + ", " + zag.Rows[0]["adressP"].ToString().Trim()).Replace("\"", "\'") + "\"";
                reportSF.DataDefinition.FormulaFields["bname"].Text     = "\"" + zag.Rows[0]["cname"].ToString().Trim().Replace("\"", "\'") + "\"";
                reportSF.DataDefinition.FormulaFields["badr"].Text      = "\"" + zag.Rows[0]["adressU"].ToString().Trim().Replace("\"", "\'") + "\"";
                reportSF.DataDefinition.FormulaFields["binn"].Text      = "\"" + (zag.Rows[0]["inn"].ToString().Trim() + "/" + zag.Rows[0]["kpp"].ToString().Trim()).Replace("\"", "\'") + "\"";
                reportSF.DataDefinition.FormulaFields["rukov"].Text     = "\"" + zagour.Rows[0]["rukov"].ToString().Trim().Replace("\"", "\'") + "\"";
                reportSF.DataDefinition.FormulaFields["glavbuh"].Text   = "\"" + zagour.Rows[0]["glavbuh"].ToString().Trim().Replace("\"", "\'") + "\"";
                reportSF.DataDefinition.FormulaFields["primech1"].Text  = "\"" + zagour.Rows[0]["comment"].ToString().Trim().Replace("\"", "\'") + "\"";
                reportSF.DataDefinition.FormulaFields["primech2"].Text  = "\"" + zagour.Rows[0]["comment"].ToString().Trim().Replace("\"", "\'") + "\"";
                reportSF.SetDataSource((DataTable)sftable);
                crvReport2.ReportSource = reportSF;
            }
            #endregion

            #region акт переоценки
            if (pereoc)
            {
                dsReports.dtSpisDataTable dtSpis = new dsReports.dtSpisDataTable();

                DataTable temp = proc.GetPrintPereoc(id);

                for (int i = 0; i < temp.Rows.Count; i++)
                {
                    dtSpis.AdddtSpisRow(int.Parse(temp.Rows[i]["npp"].ToString())
                                        , temp.Rows[i]["cname"].ToString()
                                        , 1
                                        , decimal.Parse(temp.Rows[i]["netto"].ToString())
                                        , decimal.Parse(temp.Rows[i]["zcena"].ToString())
                                        , decimal.Parse(temp.Rows[i]["rcena"].ToString())
                                        , decimal.Parse(temp.Rows[i]["zsum"].ToString())
                                        , decimal.Parse(temp.Rows[i]["rsum"].ToString())
                                        , decimal.Parse(temp.Rows[i]["nds"].ToString()));
                }

                crSpis reportSpis = new crSpis();
                reportSpis.DataDefinition.FormulaFields["Label"].Text = "\"Акт переоценки № " + temp.Rows[0]["ttn"].ToString().Trim() + " от " + ((DateTime)temp.Rows[0]["dprihod"]).ToShortDateString() + "\"";
                reportSpis.DataDefinition.FormulaFields["Dep"].Text   = "\"" + temp.Rows[0]["dep"].ToString() + "\"";
                reportSpis.SetDataSource((DataTable)dtSpis);
                crvReport.ReportSource = reportSpis;
            }
            #endregion

            #region акт списания
            if (spis)
            {
                dsReports.dtSpisDataTable dtSpis = new dsReports.dtSpisDataTable();

                DataTable temp = proc.GetPrintSpis(id);

                for (int i = 0; i < temp.Rows.Count; i++)
                {
                    dtSpis.AdddtSpisRow(int.Parse(temp.Rows[i]["npp"].ToString())
                                        , temp.Rows[i]["cname"].ToString()
                                        , 1
                                        , decimal.Parse(temp.Rows[i]["netto"].ToString())
                                        , decimal.Parse(temp.Rows[i]["zcena"].ToString())
                                        , decimal.Parse(temp.Rows[i]["rcena"].ToString())
                                        , decimal.Parse(temp.Rows[i]["zsum"].ToString())
                                        , decimal.Parse(temp.Rows[i]["rsum"].ToString())
                                        , decimal.Parse(temp.Rows[i]["nds"].ToString()));
                }

                crSpis reportSpis = new crSpis();
                reportSpis.DataDefinition.FormulaFields["Label"].Text = "\"Акт списания № " + temp.Rows[0]["ttn"].ToString().Trim() + " от " + ((DateTime)temp.Rows[0]["dprihod"]).ToShortDateString() + "\"";
                reportSpis.DataDefinition.FormulaFields["Dep"].Text   = "\"ВВО\"";
                reportSpis.SetDataSource((DataTable)dtSpis);
                crvReport.ReportSource = reportSpis;
            }
            #endregion

            #region Бухгалтерские остатки
            if (callType == 5)
            {
                crBuhSum reportSum = new crBuhSum();
                reportSum.DataDefinition.FormulaFields["date"].Text = "\"" + dateOt.ToShortDateString() + "\"";
                reportSum.SetDataSource((DataTable)dtRezult);
                crvReport.ReportSource = reportSum;
            }
            #endregion
        }
Esempio n. 26
0
        public static ReportDocument LoadInventoryMutation(int id)
        {
            ReportDocument rpt = new Inventory.rprInventoryMutation();
            dsReports ds = new dsReports();
            ds.EnforceConstraints = false;

            DenormalizedOrdersTableAdapter ta = new DenormalizedOrdersTableAdapter();
            ta.ClearBeforeFill = true;
            ta.Connection = AppHelper.GetDbConnection();
            ta.FillByItemID(ds.DenormalizedOrders, id);

            if (ds.DenormalizedOrders.Rows.Count <= 0)
                FillNoData(ds.DenormalizedOrders);

            RetrieveDeveloper(ds.Developer);
            RetrieveOwner(ds.Owner);
            rpt.SetDataSource(ds);
            return rpt;
        }
        public ActionResult Clearance_PF(int?PatientName, string Purpose)
        {
            var patient = db.Patients
                          .Select(s => new
            {
                Text  = s.PatientFirst + " " + s.PatientMid + " " + s.PatientLast,
                Value = s.PatientID
            })
                          .ToList();

            ViewBag.ddlPatient = new SelectList(patient, "Value", "Text");

            ReportViewer     reportViewer = new ReportViewer();
            ReportDataSource rds          = new ReportDataSource();
            dsReports        _dsrep       = new dsReports();

            reportViewer.ProcessingMode      = ProcessingMode.Local;
            reportViewer.SizeToReportContent = true;
            reportViewer.Width  = Unit.Percentage(75);
            reportViewer.Height = Unit.Percentage(100);

            var name = db.Patients.FirstOrDefault(b => b.PatientID == b.PatientID);

            if (PatientName != null)
            {
                rds.Name = "Clearance_PF";
                string staff = Session["staffid"].ToString();

                var x = db.MedChecks.Include(a => a.Patient).Include(b => b.Staff).Where(c => c.PatientID == PatientName).Where(m => m.StaffID == staff);
                var y = db.Patients.Find(PatientName);
                var z = db.Staffs.Find(staff);

                foreach (var item in x)
                {
                    _dsrep.Clearance_PF.AddClearance_PFRow(item.Patient.PatientFirst + " " + item.Patient.PatientMid + " " + item.Patient.PatientLast, z.StaffFirst + " " + z.StaffLast);
                }

                rds.Value = _dsrep.Clearance_PF;
                reportViewer.LocalReport.DataSources.Clear();
                reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"Views\Reports\Clearance_PF.rdlc";

                ReportParameter[] _parameter = new ReportParameter[2];
                _parameter[0] = new ReportParameter("IssuedDate", DateTime.Now.ToShortDateString());
                _parameter[1] = new ReportParameter("Purpose", Purpose);

                reportViewer.LocalReport.SetParameters(_parameter);
                reportViewer.LocalReport.DataSources.Add(rds);
                reportViewer.LocalReport.Refresh();
                ViewBag.ReportViewer = reportViewer;

                return(View());
            }

            rds.Name = "Clearance_PF";

            reportViewer.LocalReport.DataSources.Clear();
            reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"Views\Reports\Clearance_PF.rdlc";
            rds.Value = _dsrep.Clearance_PF;
            reportViewer.LocalReport.DataSources.Add(rds);
            reportViewer.LocalReport.Refresh();
            ViewBag.ReportViewer = reportViewer;

            return(View());
        }
        public ActionResult MedHistory(int?PatientName)
        {
            var patient = db.Patients
                          .Select(s => new
            {
                Text  = s.PatientFirst + " " + s.PatientMid + " " + s.PatientLast,
                Value = s.PatientID
            })
                          .ToList();

            ViewBag.ddlPatient = new SelectList(patient, "Value", "Text");

            ReportViewer     reportViewer = new ReportViewer();
            ReportDataSource rds          = new ReportDataSource();
            dsReports        _dsrep       = new dsReports();

            reportViewer.ProcessingMode      = ProcessingMode.Local;
            reportViewer.SizeToReportContent = true;
            reportViewer.Width  = Unit.Percentage(75);
            reportViewer.Height = Unit.Percentage(100);

            var name = db.Patients.FirstOrDefault(b => b.PatientID == b.PatientID);

            if (PatientName != null)
            {
                rds.Name = "MedHistory";
                var x = db.MedChecks.Include(a => a.Patient).Include(b => b.Staff).Where(c => c.PatientID == PatientName);
                var y = db.Patients.Find(PatientName);

                foreach (var item in x)
                {
                    _dsrep.MedHistory.AddMedHistoryRow(item.DateTimeOfVisit.ToShortDateString(), item.Complaint, item.Diagnosis, item.Treatment, item.Time_in.Value.ToShortTimeString(), item.Time_out.Value.ToShortTimeString(), item.Staff.StaffLast + ", " + item.Staff.StaffFirst);
                }

                rds.Value = _dsrep.MedHistory;
                reportViewer.LocalReport.DataSources.Clear();
                reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"Views\Reports\MedHistory.rdlc";

                ReportParameter[] _parameter = new ReportParameter[2];
                _parameter[0] = new ReportParameter("PatientName", y.PatientFirst + " " + y.PatientMid + " " + y.PatientLast);
                _parameter[1] = new ReportParameter("College", y.PCollege.CollegeName);

                reportViewer.LocalReport.SetParameters(_parameter);
                reportViewer.LocalReport.DataSources.Add(rds);
                reportViewer.LocalReport.Refresh();
                ViewBag.ReportViewer = reportViewer;

                return(View());
            }

            rds.Name = "MedHistory";

            reportViewer.LocalReport.DataSources.Clear();
            reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"Views\Reports\MedHistory.rdlc";
            rds.Value = _dsrep.MedHistory;
            reportViewer.LocalReport.DataSources.Add(rds);
            reportViewer.LocalReport.Refresh();
            ViewBag.ReportViewer = reportViewer;

            return(View());
        }
Esempio n. 29
0
        public static ReportDocument LoadInventoryAdjustmentList(DateTime date1, DateTime date2)
        {
            ReportDocument rpt = new Inventory.rprInventoryAdjustmentList();
            dsReports ds = new dsReports();
            ds.EnforceConstraints = false;

            DenormalizedOrdersTableAdapter ta = new DenormalizedOrdersTableAdapter();
            ta.ClearBeforeFill = true;
            ta.Connection = AppHelper.GetDbConnection();
            ta.FillInventoryAdjustments(ds.DenormalizedOrders, date1, date2);

            if (ds.DenormalizedOrders.Rows.Count <= 0)
                FillNoData(ds.DenormalizedOrders);

            RetrieveDeveloper(ds.Developer);
            RetrieveOwner(ds.Owner);
            rpt.SetDataSource(ds);
            rpt.ParameterFields["@Date1"].CurrentValues.AddValue(date1);
            rpt.ParameterFields["@Date2"].CurrentValues.AddValue(date2);
            return rpt;
        }
Esempio n. 30
0
        public DataTable Get_ITAssessment(string FisYear, string VMonth, string EmpID)
        {
            SqlCommand cmd = new SqlCommand("PROC_PAYROLL_SELECT_ITAssessment");

            cmd.CommandType = CommandType.StoredProcedure;

            SqlParameter p_Year = cmd.Parameters.Add("TaxFiscalYrId", SqlDbType.BigInt);

            p_Year.Direction = ParameterDirection.Input;
            p_Year.Value     = Convert.ToInt32(FisYear);

            SqlParameter p_VMonth = cmd.Parameters.Add("VMonth", SqlDbType.Char);

            p_VMonth.Direction = ParameterDirection.Input;
            p_VMonth.Value     = VMonth;

            SqlParameter p_EmpID = cmd.Parameters.Add("EmpID", SqlDbType.Char);

            p_EmpID.Direction = ParameterDirection.Input;
            p_EmpID.Value     = EmpID;

            objDAL.CreateDSFromProc(cmd, "dtITAssessment");
            DataTable dtITAssessment = new DataTable();

            dtITAssessment = objDAL.ds.Tables["dtITAssessment"];

            dsReports objdsPay = new dsReports();
            string    sEmpId   = "";
            DataRow   FinalRow;

            if (dtITAssessment.Rows.Count > 0)
            {
                foreach (DataRow dRow in dtITAssessment.Rows)
                {
                    FinalRow = objdsPay.dtITComputation.NewRow();

                    if (dRow["EmpId"].ToString().Trim() != sEmpId)
                    {
                        FinalRow["AssYear"] = dRow["AssYear"].ToString();
                        FinalRow["EmpId"]   = dRow["EmpId"].ToString();
                        sEmpId = dRow["EmpId"].ToString().Trim();
                        FinalRow["FullName"]            = dRow["FullName"].ToString();
                        FinalRow["SalLocName"]          = dRow["SalLocName"].ToString();
                        FinalRow["BasicSalary"]         = dRow["BasicSalary"].ToString();
                        FinalRow["YBasicSalary"]        = Common.ReturnZeroForNull(dRow["YBasicSalary"].ToString());
                        FinalRow["YHouseRent"]          = Common.ReturnZeroForNull(dRow["YHouseRent"].ToString());
                        FinalRow["YMedicalAllowance"]   = Common.ReturnZeroForNull(dRow["YMedicalAllowance"].ToString());
                        FinalRow["YTransportAllowance"] = Common.ReturnZeroForNull(dRow["YTransportAllowance"].ToString());
                        FinalRow["YFestivalBonus"]      = Common.ReturnZeroForNull(dRow["YFestivalBonus"].ToString());
                        FinalRow["YPFDeduction"]        = Common.ReturnZeroForNull(dRow["YPFDeduction"].ToString());
                        FinalRow["YOverTime"]           = Common.ReturnZeroForNull(dRow["YOverTime"].ToString());
                        FinalRow["NetTax"] = Common.ReturnZeroForNull(dRow["NetTax"].ToString());
                        FinalRow["TTI_2"]  = Common.ReturnZeroForNull(dRow["TTI_2"].ToString());
                        #region Tax Liability
                        decimal dclRemainTaxLiable = 0;
                        if (Convert.ToDecimal(Common.ReturnZeroForNull(dRow["TTI_2"].ToString())) > 250000)
                        {
                            FinalRow["TaxLiableP0"] = "250000";
                            dclRemainTaxLiable      = Convert.ToDecimal(Common.ReturnZeroForNull(dRow["TTI_2"].ToString())) - 250000;
                        }
                        else
                        {
                            FinalRow["TaxLiableP0"] = dclRemainTaxLiable;
                            dclRemainTaxLiable      = 0;
                        }

                        if (dclRemainTaxLiable > 400000)
                        {
                            FinalRow["TaxLiableP10"] = "400000";
                            dclRemainTaxLiable       = dclRemainTaxLiable - 400000;
                        }
                        else
                        {
                            FinalRow["TaxLiableP10"] = dclRemainTaxLiable;
                            dclRemainTaxLiable       = 0;
                        }

                        if (dclRemainTaxLiable > 500000)
                        {
                            FinalRow["TaxLiableP15"] = "500000";
                            dclRemainTaxLiable       = dclRemainTaxLiable - 500000;
                        }
                        else
                        {
                            FinalRow["TaxLiableP15"] = dclRemainTaxLiable;
                            dclRemainTaxLiable       = 0;
                        }

                        if (dclRemainTaxLiable > 600000)
                        {
                            FinalRow["TaxLiableP20"] = "600000";
                            dclRemainTaxLiable       = dclRemainTaxLiable - 600000;
                        }
                        else
                        {
                            FinalRow["TaxLiableP20"] = dclRemainTaxLiable;
                            dclRemainTaxLiable       = 0;
                        }

                        if (dclRemainTaxLiable > 3000000)
                        {
                            FinalRow["TaxLiableP25"] = "3000000";
                            dclRemainTaxLiable       = dclRemainTaxLiable - 3000000;
                        }
                        else
                        {
                            FinalRow["TaxLiableP25"] = dclRemainTaxLiable;
                            dclRemainTaxLiable       = 0;
                        }

                        if (dclRemainTaxLiable > 3000000)
                        {
                            FinalRow["TaxLiableP30"] = "3000000";
                            dclRemainTaxLiable       = dclRemainTaxLiable - 3000000;
                        }
                        else
                        {
                            FinalRow["TaxLiableP30"] = dclRemainTaxLiable;
                            dclRemainTaxLiable       = 0;
                        }
                        #endregion
                        FinalRow["P10"]         = Common.ReturnZeroForNull(dRow["P10"].ToString());
                        FinalRow["P15"]         = Common.ReturnZeroForNull(dRow["P15"].ToString());
                        FinalRow["P20"]         = Common.ReturnZeroForNull(dRow["P20"].ToString());
                        FinalRow["P25"]         = Common.ReturnZeroForNull(dRow["P25"].ToString());
                        FinalRow["P30"]         = Common.ReturnZeroForNull(dRow["P30"].ToString());
                        FinalRow["G_Tax"]       = Common.ReturnZeroForNull(dRow["G_Tax"].ToString());
                        FinalRow["Rebate"]      = Common.ReturnZeroForNull(dRow["Rebate"].ToString());// ((((Convert.ToDecimal(FinalRow["TTI_2"]) * 30) / 100) * 15) / 100);
                        FinalRow["MonthlyTax"]  = Common.ReturnZeroForNull(dRow["MonthlyTax"].ToString());
                        FinalRow["ITDeposited"] = Common.ReturnZeroForNull(dRow["ITDeposited"].ToString());
                        FinalRow["VMonthNo"]    = Common.ReturnZeroForNull(dRow["VMonthNo"].ToString());
                        objdsPay.dtITComputation.Rows.Add(FinalRow);
                        objdsPay.dtITComputation.AcceptChanges();
                    }
                }
            }
            return(objdsPay.dtITComputation);
        }
Esempio n. 31
0
        public static ReportDocument LoadItemList()
        {
            ReportDocument rpt = new Master.rptItemList();
            dsReports ds = new dsReports();
            ds.EnforceConstraints = false;

            ItemsTableAdapter ta = new ItemsTableAdapter();
            ta.ClearBeforeFill = true;
            ta.Connection = AppHelper.GetDbConnection();
            ta.Fill(ds.Items);

            RetrieveDeveloper(ds.Developer);
            RetrieveOwner(ds.Owner);
            rpt.SetDataSource(ds);
            return rpt;
        }
        // GET: Reports
        public ActionResult GenerateLogbook(DateTime?DateFrom, DateTime?DateTo)
        {
            ReportViewer     reportViewer = new ReportViewer();
            ReportDataSource rds          = new ReportDataSource();
            dsReports        _dsrep       = new dsReports();

            reportViewer.ProcessingMode      = ProcessingMode.Local;
            reportViewer.SizeToReportContent = true;
            reportViewer.Width  = Unit.Percentage(100);
            reportViewer.Height = Unit.Percentage(100);

            if (DateFrom != null && DateTo != null)
            {
                rds.Name = "DTR";
                var x = db.MedChecks.Include(a => a.Patient).Include(b => b.Patient.PCollege).Where(c => c.DateTimeOfVisit >= DateFrom && c.DateTimeOfVisit <= DateTo);

                foreach (var item in x)
                {
                    if (item.Time_out == null && item.Time_in == null)
                    {
                        _dsrep.DTR.AddDTRRow(item.Patient.PatientLast + ", " + item.Patient.PatientFirst, item.Patient.PCollege.CollegeName, item.Complaint, item.Treatment, "n/a", "n/a", item.Diagnosis, item.Patient.PatientClass);
                    }
                    else if (item.Time_in == null)
                    {
                        _dsrep.DTR.AddDTRRow(item.Patient.PatientLast + ", " + item.Patient.PatientFirst, item.Patient.PCollege.CollegeName, item.Complaint, item.Treatment, "n/a", item.Time_out.Value.ToShortTimeString(), item.Diagnosis, item.Patient.PatientClass);
                    }
                    else if (item.Time_out == null)
                    {
                        _dsrep.DTR.AddDTRRow(item.Patient.PatientLast + ", " + item.Patient.PatientFirst, item.Patient.PCollege.CollegeName, item.Complaint, item.Treatment, item.Time_in.Value.ToShortTimeString(), "n/a", item.Diagnosis, item.Patient.PatientClass);
                    }
                    else
                    {
                        _dsrep.DTR.AddDTRRow(item.Patient.PatientLast + ", " + item.Patient.PatientFirst, item.Patient.PCollege.CollegeName, item.Complaint, item.Treatment, item.Time_in.Value.ToShortTimeString(), item.Time_out.Value.ToShortTimeString(), item.Diagnosis, item.Patient.PatientClass);
                    }
                }

                rds.Value = _dsrep.DTR;
                reportViewer.LocalReport.DataSources.Clear();
                reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"Views\Reports\Logbook.rdlc";

                ReportParameter[] _parameter = new ReportParameter[2];
                _parameter[0] = new ReportParameter("DateFrom", DateFrom.Value.ToShortDateString());
                _parameter[1] = new ReportParameter("DateTo", DateTo.Value.ToShortDateString());

                reportViewer.LocalReport.SetParameters(_parameter);
                reportViewer.LocalReport.DataSources.Add(rds);
                reportViewer.LocalReport.Refresh();
                ViewBag.ReportViewer = reportViewer;
                return(View());
            }

            rds.Name = "DTR";

            reportViewer.LocalReport.DataSources.Clear();
            reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"Views\Reports\Logbook.rdlc";
            rds.Value = _dsrep.MedHistory;
            reportViewer.LocalReport.DataSources.Add(rds);
            reportViewer.LocalReport.Refresh();
            ViewBag.ReportViewer = reportViewer;

            return(View());
        }