Exemplo n.º 1
0
        public int AddReturnReport(ReturnReport returnReport)
        {
            _db.ReturnReports.Add(returnReport);
            _db.SaveChanges();

            return(returnReport.Id);
        }
Exemplo n.º 2
0
 public GetReturnReportDto ReturnReportToGetReturnReportDto(ReturnReport returnReport)
 {
     return(new GetReturnReportDto
     {
         Id = returnReport.Id,
         DrivenDistance = returnReport.DrivenDistance,
         IsDamaged = returnReport.IsDamaged,
         ReturnDate = returnReport.ReturnDate,
         IsDeleted = returnReport.IsDeleted,
         OrderId = returnReport.OrderId
     });
 }
Exemplo n.º 3
0
        private void button2_Click(object sender, EventArgs e)
        {
            var indices = lvOrderList.SelectedItems.Count;

            if (indices < 1)
            {
                return;
            }

            int id = Convert.ToInt32(lvOrderList.SelectedItems[0].SubItems[0].Text);

            var rr = new ReturnReport(id);

            rr.Show();
        }
Exemplo n.º 4
0
        public ReturnReport UpdateReturnReport(int id, ReturnReport returnReport)
        {
            var currentRecord = _db.ReturnReports.First(rr => rr.Id == id);

            foreach (PropertyInfo property in returnReport.GetType().GetProperties())
            {
                var value = returnReport.GetType().GetProperty(property.Name).GetValue(returnReport, null);
                if (value != null && property.Name.ToLower() != "id")
                {
                    currentRecord.GetType().GetProperty(property.Name).SetValue(currentRecord, value);
                }
            }
            _db.SaveChanges();

            return(currentRecord);
        }
Exemplo n.º 5
0
    public void PrintReturnhistory()
    {
        string ConnectionString = ConfigurationManager.ConnectionStrings["PointofSaleConstr"].ConnectionString;
        string ss = (string)Session["ShopID"];

        string dateFrom = Session["DateFrom"].ToString();
        string dateTo   = Session["DateTo"].ToString();
        string ShopID   = Session["StoreId"].ToString();

        string CompanyName          = null;
        string ComapanyAddress      = null;
        string CompanyMobileNumber  = null;
        string CompanyWebsite       = null;
        string CompanyFooterMassage = null;
        string CompanyLogo          = null;

        List <ReturnReport> ReturnReports = new List <ReturnReport>();


        try
        {
            SqlConnection cn  = new SqlConnection(ConnectionString);
            SqlCommand    cmd = new SqlCommand();

            cn.Open();
            cmd.CommandText = "select ItemCode as Code,ItemName as Name ,Qty as Quantity,Price,DiscRate as Discount,total as Total, RP_ID as Return_Invoice from tbl_Return where ShopID = '" + ShopID + "' and Logdate between '" + dateFrom + "' and '" + dateTo + "'";
            cmd.Connection  = cn;



            SqlDataReader rd = cmd.ExecuteReader();

            var dt = new DataTable();
            dt.Load(rd);
            List <DataRow> dr = dt.AsEnumerable().ToList();

            for (int i = 0; i < dr.Count; i++)
            {
                ReturnReport list = new ReturnReport();

                list.Code           = dr[i].ItemArray[0].ToString();
                list.Name           = dr[i].ItemArray[1].ToString();
                list.Quantity       = dr[i].ItemArray[2].ToString();
                list.Price          = dr[i].ItemArray[3].ToString();
                list.Discount       = dr[i].ItemArray[4].ToString();
                list.Total          = Convert.ToDouble(dr[i].ItemArray[5]);
                list.Return_Invoice = dr[i].ItemArray[6].ToString();



                ReturnReports.Add(list);
            }
            cn.Close();
        }
        catch
        {
            // lbtotalRow.Text = "No Records Found";
        }

        // Company Info

        try
        {
            SqlConnection cn  = new SqlConnection(ConnectionString);
            SqlCommand    cmd = new SqlCommand();

            cn.Open();
            cmd.CommandText = "Select * from tbl_settings where Location='" + ss + "'";
            cmd.Connection  = cn;
            SqlDataReader rd4 = cmd.ExecuteReader();

            if (rd4.HasRows)
            {
                while (rd4.Read())
                {
                    CompanyName          = (rd4["CompanyName"].ToString());
                    ComapanyAddress      = rd4["CompanyAddress"].ToString();
                    CompanyWebsite       = rd4["WebAddress"].ToString();
                    CompanyMobileNumber  = rd4["Phone"].ToString();
                    CompanyFooterMassage = rd4["Footermsg"].ToString();
                    CompanyLogo          = rd4["CompanyLogo"].ToString();
                }
                cn.Close();
            }
        }
        catch { }



        string imagePath        = new Uri(Server.MapPath(CompanyLogo)).AbsoluteUri;
        var    reportParameters = new ReportParameterCollection
        {
            new ReportParameter("CompanyName", CompanyName),
            new ReportParameter("ComapanyAddress", ComapanyAddress),
            new ReportParameter("CompanyMobileNumber", CompanyMobileNumber),
            new ReportParameter("CompanyWebsite", CompanyWebsite),
            new ReportParameter("CompanyFooterMassage", CompanyFooterMassage),
            new ReportParameter("DateFrom", dateFrom),
            new ReportParameter("DateTo", dateTo),
            new ReportParameter("CompanyLogo", imagePath)
        };


        ReportViewer1.ProcessingMode         = ProcessingMode.Local;
        ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/RDLCReports/ReturnHistoryReport.rdlc");

        ReportDataSource datasource = new ReportDataSource("ReturnReportsDataset", ReturnReports);

        ReportViewer1.LocalReport.DataSources.Clear();

        ReportViewer1.LocalReport.EnableExternalImages = true;
        ReportViewer1.ExportContentDisposition         = ContentDisposition.AlwaysInline;

        ReportViewer1.LocalReport.DataSources.Add(datasource);
        ReportViewer1.LocalReport.SetParameters(reportParameters);
    }