public void printItemList(ref int ID, ref double TotalQuantity, ref double TotalOrder, ref string Print) { var orderdetails = RefundGoodDetailController.GetByRefundGoodsID(ID); if (orderdetails.Count > 0) { foreach (var item in orderdetails) { TotalQuantity += Convert.ToDouble(item.Quantity); int ProductType = Convert.ToInt32(item.ProductType); double ItemPrice = Convert.ToDouble(item.SoldPricePerProduct); string SKU = item.SKU; string ProductName = ""; int SubTotal = (Convert.ToInt32(ItemPrice) - Convert.ToInt32(item.RefundFeePerProduct)) * Convert.ToInt32(item.Quantity); Print += "<tr>"; if (ProductType == 1) { var product = ProductController.GetBySKU(SKU); if (product != null) { ProductName = product.ProductTitle; Print += "<td colspan='4'><strong>" + SKU + "</strong> - " + PJUtils.Truncate(ProductName, 27) + "</td>"; } } else { var productvariable = ProductVariableController.GetBySKU(SKU); if (productvariable != null) { var parent_product = ProductController.GetByID(Convert.ToInt32(productvariable.ProductID)); if (parent_product != null) { ProductName = parent_product.ProductTitle; } Print += "<td colspan='4'><strong>" + SKU + "</strong> - " + PJUtils.Truncate(ProductName, 27) + "</td>"; } } Print += "</tr>"; Print += "<tr>"; Print += "<td>" + item.Quantity + "</td>"; Print += "<td>" + string.Format("{0:N0}", ItemPrice) + "</td>"; Print += "<td>" + string.Format("{0:N0}", Convert.ToDouble(item.RefundFeePerProduct)) + "</td>"; Print += "<td>" + string.Format("{0:N0}", SubTotal) + "</td>"; Print += "</tr>"; TotalOrder += SubTotal; } } }
public void LoadData() { string username = Request.Cookies["userLoginSystem"].Value; var acc = AccountController.GetByUsername(username); if (acc != null) { int AgentID = Convert.ToInt32(acc.AgentID); int ID = Request.QueryString["id"].ToInt(0); if (ID > 0) { ViewState["ID"] = ID; var r = RefundGoodController.GetByIDAndAgentID(ID, AgentID); if (r == null) { PJUtils.ShowMessageBoxSwAlertError("Không tìm thấy đơn hàng " + ID, "e", true, "/danh-sach-don-tra-hang", Page); } else { if (acc.RoleID != 0) { if (r.CreatedBy != acc.Username) { PJUtils.ShowMessageBoxSwAlertError("Đơn hàng này không phải của bạn", "e", true, "/danh-sach-don-tra-hang", Page); } } ltrOrderID.Text = ID.ToString(); ltrCreateBy.Text = r.CreatedBy; ltrCreateDate.Text = r.CreatedDate.ToString(); ltrOrderStatus.Text = PJUtils.RefundStatus(Convert.ToInt32(r.Status)); if (r.OrderSaleID > 0) { ltrOrderSaleID.Text = "<td><a class=\"customer-name-link\" target=\"_blank\" title=\"Bấm vào xem đơn hàng trừ tiền\" href=\"/thong-tin-don-hang?id=" + r.OrderSaleID + "\">" + r.OrderSaleID + " (Xem đơn)</a>"; } else { ltrOrderSaleID.Text = ""; } ltrOrderQuantity.Text = r.TotalQuantity.ToString(); ltrOrderTotalPrice.Text = string.Format("{0:N0}", (Convert.ToDouble(r.TotalPrice))); ltrTotalRefundFee.Text = string.Format("{0:N0}", (Convert.ToDouble(r.TotalRefundFee))); ltrRefundNote.Text = r.RefundNote; ltrInfo.Text += "<div class=\"row\">"; ltrInfo.Text += "<div class=\"col-md-6\">"; ltrInfo.Text += "<div class=\"form-group\">"; ltrInfo.Text += "<label>Họ tên</label>"; ltrInfo.Text += "<span class=\"form-control input-disabled\">" + r.CustomerName + "</span>"; ltrInfo.Text += "</div>"; ltrInfo.Text += "</div>"; ltrInfo.Text += "<div class=\"col-md-6\">"; ltrInfo.Text += "<div class=\"form-group\">"; ltrInfo.Text += "<label>Điện thoại</label>"; ltrInfo.Text += "<span class=\"form-control input-disabled\">" + r.CustomerPhone + "</span>"; ltrInfo.Text += "</div>"; ltrInfo.Text += "</div>"; ltrInfo.Text += "</div>"; var cus = CustomerController.GetByID(r.CustomerID.Value); if (cus != null) { ltrInfo.Text += "<div class=\"row\">"; ltrInfo.Text += "<div class=\"col-md-6\">"; ltrInfo.Text += "<div class=\"form-group\">"; ltrInfo.Text += "<label>Nick đặt hàng</label>"; ltrInfo.Text += "<span class=\"form-control input-disabled\">" + cus.Nick + "</span>"; ltrInfo.Text += "</div>"; ltrInfo.Text += "</div>"; ltrInfo.Text += "<div class=\"col-md-6\">"; ltrInfo.Text += "<div class=\"form-group\">"; ltrInfo.Text += "<label>Địa chỉ</label>"; ltrInfo.Text += "<span class=\"form-control input-disabled\">" + cus.CustomerAddress + "</span>"; ltrInfo.Text += "</div>"; ltrInfo.Text += "</div>"; ltrInfo.Text += "</div>"; ltrInfo.Text += "<div class=\"row\">"; ltrInfo.Text += "<div class=\"col-md-6\">"; ltrInfo.Text += "<div class=\"form-group\">"; ltrInfo.Text += "<label>Zalo</label>"; ltrInfo.Text += "<span class=\"form-control input-disabled\">" + cus.Zalo + "</span>"; ltrInfo.Text += "</div>"; ltrInfo.Text += "</div>"; ltrInfo.Text += "<div class=\"col-md-6\">"; ltrInfo.Text += "<div class=\"form-group\">"; ltrInfo.Text += "<label>Facebook</label>"; ltrInfo.Text += "<span class=\"form-control input-disabled\">" + cus.Facebook + "</span>"; ltrInfo.Text += "</div>"; ltrInfo.Text += "</div>"; ltrInfo.Text += "</div>"; ltrInfo.Text += "<div class=\"row\">"; ltrInfo.Text += " <div class=\"col-md-12 view-detail\">"; ltrInfo.Text += " <a href=\"javascript:;\" class=\"btn primary-btn fw-btn not-fullwidth\" onclick=\"viewCustomerDetail('"+ cus.ID + "')\"><i class=\"fa fa-address-card-o\" aria-hidden=\"true\"></i> Xem chi tiết</a>"; ltrInfo.Text += " </div>"; ltrInfo.Text += "</div>"; } ltrTotal.Text = string.Format("{0:N0}", Convert.ToDouble(r.TotalPrice)); ltrQuantity.Text = string.Format("{0:N0}", Convert.ToDouble(r.TotalQuantity)); ltrRefund.Text = string.Format("{0:N0}", Convert.ToDouble(r.TotalRefundFee)); // get info tranfor page tao-don-hang-doi-tra.aspx _refundGood.RefundGoodsID = ID; _refundGood.CustomerName = r.CustomerName; _refundGood.CustomerPhone = r.CustomerPhone; _refundGood.CustomerNick = cus != null? cus.Nick : String.Empty; _refundGood.CustomerAddress = cus != null ? cus.CustomerAddress : String.Empty; _refundGood.CustomerZalo = cus != null ? cus.Zalo : String.Empty; _refundGood.CustomerFacebook = cus != null ? cus.Facebook : String.Empty; _refundGood.RefundDetails = RefundGoodDetailController.GetInfoShowRefundDetail(ID); _refundGood.TotalPrice = Convert.ToDouble(r.TotalPrice); _refundGood.TotalQuantity = Convert.ToDouble(r.TotalQuantity); _refundGood.TotalFreeRefund = Convert.ToDouble(r.TotalRefundFee); _refundGood.Status = r.Status.Value; _refundGood.Note = txtRefundsNote.Text; _refundGood.CreateBy = r.CreatedBy; var rds = RefundGoodDetailController.GetByRefundGoodsID(ID); var product = _refundGood.RefundDetails .Join( rds, p1 => new { RefundGoodsID = p1.RefundGoodsID, RefundDetailID = p1.RefundDetailID }, p2 => new { RefundGoodsID = p2.RefundGoodsID.Value, RefundDetailID = p2.ID }, (p1, p2) => new { p1, p2 }) .Select(x => new { SKU = x.p2.SKU, OrderID = x.p2.OrderID, ProductName = x.p2.ProductName, ProductType = x.p2.ProductType, GiavonPerProduct = x.p2.GiavonPerProduct, SoldPricePerProduct = x.p2.SoldPricePerProduct, DiscountPricePerProduct = x.p2.DiscountPricePerProduct, Quantity = x.p2.Quantity, QuantityMax = x.p2.QuantityMax, RefundType = x.p2.RefundType, RefundFeePerProduct = x.p2.RefundFeePerProduct, TotalPriceRow = x.p2.TotalPriceRow, ProductImage = x.p1.ProductImage }) .ToList(); if (product.Count > 0) { string html = ""; int t = 0; foreach (var item in product) { var variables = ProductVariableValueController.GetByProductVariableSKU(item.SKU); string variable = ""; if (variables.Count > 0) { variable += "<br><br>"; foreach (var v in variables) { variable += v.VariableName.Trim() + ": " + v.VariableValue.Trim() + "<br>"; } } t++; html += "<tr ondblclick=\"clickrow($(this))\" class=\"product-result\" data-sku=\"" + item.SKU + "\" data-orderID=\"" + item.OrderID + "\" data-ProductName=\"" + item.ProductName + "\" data-ProductType=\"" + item.ProductType + "\" data-Giagoc=\"" + item.GiavonPerProduct + "\" data-Giadaban=\"" + item.SoldPricePerProduct + "\" data-TienGiam=\"" + item.DiscountPricePerProduct + "\" data-Soluongtoida=\"" + item.QuantityMax + "\" data-RefundFee=\"" + item.RefundFeePerProduct + "\" >"; html += " <td>" + t + "</td>"; html += " <td><img src='" + item.ProductImage + "'></td>"; html += " <td>" + item.ProductName + variable + "</td>"; html += " <td>" + item.SKU + "</td>"; html += " <td class=\"giagoc\" data-giagoc=\"" + item.GiavonPerProduct + "\">" + string.Format("{0:N0}", Convert.ToDouble(item.GiavonPerProduct)) + "</td>"; html += " <td class=\"giadaban\" data-giadaban=\"" + item.SoldPricePerProduct + "\"><strong>" + string.Format("{0:N0}", Convert.ToDouble(item.SoldPricePerProduct)) + "</strong><br>(CK: " + string.Format("{0:N0}", Convert.ToDouble(item.DiscountPricePerProduct)) + ")</td>"; html += " <td class=\"slcandoi\">" + item.Quantity + "</td>"; html += " <td>"; int refundType = Convert.ToInt32(item.RefundType); string refuntTypeName = ""; if (item.RefundType == 1) { refuntTypeName = "Đổi size"; } else if (item.RefundType == 2) { refuntTypeName = "Đổi sản phẩm khác"; } else { refuntTypeName = "Đổi hàng lỗi"; } html += refuntTypeName; html += " </td>"; html += " <td class=\"phidoihang\">" + string.Format("{0:N0}", Convert.ToDouble(item.RefundFeePerProduct)) + "</td>"; html += " <td class=\"thanhtien\">" + string.Format("{0:N0}", Convert.ToDouble(item.TotalPriceRow)) + "</td>"; html += "</tr>"; } ddlRefundStatus.SelectedValue = r.Status.ToString(); txtRefundsNote.Text = r.RefundNote; ltrList.Text = html; } ltrPrint.Text = "<a href=\"/print-invoice-return?id=" + ID + "\" target=\"_blank\" class=\"btn primary-btn fw-btn not-fullwidth\"><i class=\"fa fa-print\" aria-hidden=\"true\"></i> In hóa đơn</a>"; ltrPrint.Text += "<a href=\"/print-return-order-image?id=" + ID + "\" target=\"_blank\" class=\"btn primary-btn fw-btn not-fullwidth print-invoice-merged\"><i class=\"fa fa-picture-o\" aria-hidden=\"true\"></i> Lấy ảnh đơn hàng</a>"; } } } }
public static string checkphone(string phonefullname) { RefundCust rf = new RefundCust(); int AgentID = 0; string username = HttpContext.Current.Request.Cookies["usernameLoginSystem"].Value; if (!string.IsNullOrEmpty(username)) { var a = AccountController.GetByUsername(username); if (a != null) { AgentID = Convert.ToInt32(a.AgentID); } } var customer = CustomerController.GetByPhone(phonefullname); if (customer != null) { rf.CustName = customer.CustomerName; rf.CustPhone = customer.CustomerPhone; rf.CustZalo = customer.Zalo; rf.CustFB = customer.Facebook; rf.CustAddress = customer.CustomerAddress; int custID = customer.ID; double FeeRefund = 0; double NumOfDateToChangeProduct = 0; double NumOfProductCanChange = 0; var config = ConfigController.GetByTop1(); if (config != null) { FeeRefund = Convert.ToDouble(config.FeeChangeProduct); NumOfDateToChangeProduct = Convert.ToDouble(config.NumOfDateToChangeProduct); NumOfProductCanChange = Convert.ToDouble(config.NumOfProductCanChange); } var d = DiscountCustomerController.getbyCustID(custID); if (d.Count > 0) { FeeRefund = d[0].FeeRefund; NumOfDateToChangeProduct = d[0].NumOfDateToChangeProduct; NumOfProductCanChange = d[0].NumOfProductCanChange; } DateTime toDate = DateTime.Now.Date; var fromDate = toDate.AddDays(-NumOfDateToChangeProduct); double totalProductRefund = 0; var refundList = RefundGoodController.GetByAgentIDCustomerIDFromDateToDate(AgentID, custID, fromDate, toDate.AddDays(1)); if (refundList.Count > 0) { foreach (var item in refundList) { var rfD = RefundGoodDetailController.GetByRefundGoodsID(item.ID); if (rfD.Count > 0) { foreach (var fd in rfD) { totalProductRefund += Convert.ToDouble(fd.Quantity); } } } } double leftCanchange = NumOfProductCanChange - totalProductRefund; if (leftCanchange > 0) { rf.CustleftCanchange = leftCanchange.ToString(); JavaScriptSerializer serializer = new JavaScriptSerializer(); return(serializer.Serialize(rf)); } else { rf.CustleftCanchange = "full"; JavaScriptSerializer serializer = new JavaScriptSerializer(); return(serializer.Serialize(rf)); } } else { rf.CustleftCanchange = "nocustomer"; JavaScriptSerializer serializer = new JavaScriptSerializer(); return(serializer.Serialize(rf)); } }
public void LoadData() { int ID = Request.QueryString["id"].ToInt(0); if (ID > 0) { var order = RefundGoodController.GetByID(ID); if (order != null) { string error = ""; string Print = ""; double TotalQuantity = 0; double TotalOrder = 0; var orderdetails = RefundGoodDetailController.GetByRefundGoodsID(ID); var numberOfOrders = RefundGoodController.GetByCustomerID(Convert.ToInt32(order.CustomerID)); if (orderdetails.Count > 0) { printItemList(ref ID, ref TotalQuantity, ref TotalOrder, ref Print); string productPrint = ""; string shtml = ""; productPrint += "<div class='body'>"; productPrint += "<div class='table-1'>"; productPrint += "<h1>ĐƠN ĐỔI HÀNG #" + order.ID + "</h1>"; productPrint += "<table>"; productPrint += "<colgroup>"; productPrint += "<col class='col-left' />"; productPrint += "<col class='col-right' />"; productPrint += "</colgroup>"; productPrint += "<tbody>"; productPrint += "<tr>"; productPrint += "<td>Khách hàng</td>"; productPrint += "<td>" + order.CustomerName + "</td>"; productPrint += "</tr>"; productPrint += "<tr>"; productPrint += "<td>Điện thoại</td>"; productPrint += "<td>" + order.CustomerPhone + "</td>"; productPrint += "</tr>"; productPrint += "<tr>"; productPrint += "</tr>"; productPrint += "<tr>"; productPrint += "<td>Ngày tạo</td>"; string date = string.Format("{0:dd/MM/yyyy HH:mm}", order.CreatedDate); productPrint += "<td>" + date + "</td>"; productPrint += "</tr>"; productPrint += "<tr>"; productPrint += "<td>Nhân viên</td>"; productPrint += "<td>" + order.CreatedBy + "</td>"; productPrint += "</tr>"; productPrint += "<tr>"; productPrint += "<td>Trạng thái</td>"; if (order.Status == 1) { productPrint += "<td>Chưa trừ tiền</td>"; } else { productPrint += "<td>Đã trừ tiền</td>"; } productPrint += "</tr>"; if (!string.IsNullOrEmpty(order.RefundNote)) { productPrint += "<tr>"; productPrint += "<td>Ghi chú</td>"; productPrint += "<td>" + order.RefundNote + "</td>"; productPrint += "</tr>"; } productPrint += "</tbody>"; productPrint += "</table>"; productPrint += "</div>"; productPrint += "<div class='table-2 print-invoice-return'>"; productPrint += "<table>"; productPrint += "<colgroup>"; productPrint += "<col class='soluong' />"; productPrint += "<col class='gia' />"; productPrint += "<col class='gia' />"; productPrint += "<col class='tong' />"; productPrint += "</colgroup>"; productPrint += "<thead>"; productPrint += "<th>SL</th>"; productPrint += "<th>Giá</th>"; productPrint += "<th>Phí</th>"; productPrint += "<th>Tổng</th>"; productPrint += "</thead>"; productPrint += "<tbody>"; productPrint += Print; productPrint += "</tbody>"; productPrint += "</table>"; productPrint += "</div>"; productPrint += "<div class='table-3'>"; productPrint += "<table>"; productPrint += "<tr>"; productPrint += "<td colspan='2'>Số lượng</td>"; productPrint += "<td>" + TotalQuantity + " </td>"; productPrint += "</tr>"; if (TotalOrder != Convert.ToDouble(order.TotalPrice)) { error += "Đơn hàng tính sai tổng tiền"; } productPrint += "<tr>"; productPrint += "<td colspan='2'>Phí đổi hàng</td>"; productPrint += "<td>" + string.Format("{0:N0}", Convert.ToDouble(order.TotalRefundFee)) + " </td>"; productPrint += "</tr>"; productPrint += "<tr>"; productPrint += "<td class='strong' colspan='2'>TỔNG TIỀN (đã trừ phí)</td>"; productPrint += "<td class='strong'>" + string.Format("{0:N0}", TotalOrder) + " </td>"; productPrint += "</tr>"; productPrint += "</tbody>"; productPrint += "</table>"; productPrint += "</div>"; productPrint += "</div>"; shtml += "<div class='hoadon'>"; shtml += "<div class='all'>"; shtml += productPrint; if (numberOfOrders.Count < 4) { shtml += "<div class='footer'>"; shtml += "<p>Quý khách lưu ý:</p>"; shtml += "<p>- Miễn phí đổi hàng lỗi hoặc đổi size/màu cùng mẫu.</p>"; shtml += "<p>- Tính phí đổi hàng tồn hoặc đổi sang mẫu khác.</p>"; shtml += "<p>- ANN chỉ hoàn lại tiền mặt khi tổng tiền dưới 50.000.</p>"; shtml += "<p>- Đơn trên 50.000 được trừ vào đơn mua hàng kế tiếp.</p>"; shtml += "<p>- Giá trên này là giá bán ra đã trừ chiết khấu nếu có.</p>"; shtml += "</div>"; } shtml += "</div>"; shtml += "</div>"; if (error != "") { ltrPrintInvoice.Text = "Xảy ra lỗi: " + error; ltrPrintEnable.Text = ""; } else { ltrPrintInvoice.Text = shtml; ltrPrintEnable.Text = "<div class='print-enable true'></div>"; } } } else { ltrPrintInvoice.Text = "Không tìm thấy đơn hàng " + ID; } } else { ltrPrintInvoice.Text = "Xảy ra lỗi!!!"; } }
public void LoadData() { string fromdate = ""; string todate = ""; if (Request.QueryString["fromdate"] != null) { fromdate = Request.QueryString["fromdate"]; } if (Request.QueryString["todate"] != null) { todate = Request.QueryString["todate"]; } DateTime now = DateTime.Now; var start = new DateTime(now.Year, now.Month, 1, 0, 0, 0); if (!string.IsNullOrEmpty(fromdate)) { rFromDate.SelectedDate = Convert.ToDateTime(fromdate); } else { fromdate = start.ToString(); } if (!string.IsNullOrEmpty(todate)) { rToDate.SelectedDate = Convert.ToDateTime(todate); } var refund = RefundGoodController.TotalRefund(fromdate, todate); if (refund != null) { int total = 0; int kt = 0; int ct = 0; foreach (var item in refund) { var refundg = RefundGoodDetailController.GetByRefundGoodsID(item.ID); if (refundg != null) { foreach (var temp in refundg) { total += Convert.ToInt32(temp.Quantity); if (temp.RefundType == 2) { ct += Convert.ToInt32(temp.Quantity); } else { kt += Convert.ToInt32(temp.Quantity); } } } } ltrList.Text += "<tr>"; ltrList.Text += "<td style=\"text-align:center;\">" + total + "</td>"; ltrList.Text += "<td>" + ct + "</td>"; ltrList.Text += "<td>" + kt + "</td>"; ltrList.Text += "</tr>"; } }
public static string getOrder(int ID) { JavaScriptSerializer serializer = new JavaScriptSerializer(); string username = HttpContext.Current.Request.Cookies["userLoginSystem"].Value; var acc = AccountController.GetByUsername(username); if (acc != null) { int AgentID = Convert.ToInt32(acc.AgentID); var agent = AgentController.GetByID(AgentID); if (agent != null) { } //List<GetOutOrder> go = new List<GetOutOrder>(); GetOutRefundOrder getOrder = new GetOutRefundOrder(); var refund = RefundGoodController.GetByID(ID); if (refund != null) { var refunddetail = RefundGoodDetailController.GetByRefundGoodsID(refund.ID); if (refunddetail != null) { //table 1 getOrder.ID = refund.ID; getOrder.CustomerName = refund.CustomerName; getOrder.CustomerPhone = refund.CustomerPhone; if (refund.Status == 1) { getOrder.Status = "Chưa trừ tiền"; } if (refund.Status == 2) { getOrder.Status = "Đã trừ tiền"; } getOrder.CreatedBy = refund.CreatedBy; getOrder.CreateDate = string.Format("{0:dd/MM/yyyy}", refund.CreatedDate); getOrder.ListAgent += agent.AgentAddress + "|"; getOrder.ListAgent += agent.AgentPhone; for (int j = 0; j < refunddetail.Count(); j++) { getOrder.ListProduct += refunddetail[j].SKU + ";" + refunddetail[j].ProductName + ";"; var productvalue = ProductVariableValueController.GetByProductVariableSKU(refunddetail[j].SKU); string value = ""; if (productvalue != null) { foreach (var item in productvalue) { value += item.VariableName + ":" + item.VariableValue + "|"; } } getOrder.ListProduct += value + ";" + refunddetail[j].Quantity + ";" + refunddetail[j].SoldPricePerProduct + ";" + refunddetail[j].RefundFeePerProduct + ";" + refunddetail[j].TotalPriceRow + "*"; } getOrder.TotalQuantity = Convert.ToInt32(refund.TotalQuantity); getOrder.TotalPrice = Convert.ToInt32(refund.TotalPrice); getOrder.TotalRefundPrice = Convert.ToInt32(refund.TotalRefundFee); } } return(serializer.Serialize(getOrder)); } return(serializer.Serialize(null)); }
public void printItemList(ref int ID, ref double TotalQuantity, ref double TotalOrder, ref string Print, ref double TotalFee) { var orderdetails = RefundGoodDetailController.GetByRefundGoodsID(ID); if (orderdetails.Count > 0) { int t = 0; int print = 1; foreach (var item in orderdetails) { TotalQuantity += Convert.ToDouble(item.Quantity); int ProductType = Convert.ToInt32(item.ProductType); double ItemPrice = Convert.ToDouble(item.GiavonPerProduct); double SoldPrice = Convert.ToDouble(item.SoldPricePerProduct); double RefundFee = Convert.ToDouble(item.RefundFeePerProduct); string SKU = item.SKU; string ProductName = ""; string ProductImage = "/App_Themes/Ann/image/placeholder.png"; int SubTotal = (Convert.ToInt32(SoldPrice) - Convert.ToInt32(item.RefundFeePerProduct)) * Convert.ToInt32(item.Quantity); t++; Print += "<tr>"; Print += "<td>" + t + "</td>"; if (ProductType == 1) { var product = ProductController.GetBySKU(SKU); if (product != null) { ProductName = product.ProductTitle; if (!string.IsNullOrEmpty(product.ProductImage)) { ProductImage = product.ProductImage; } Print += "<td><image src=\"" + ProductImage + "\" /></td> "; Print += "<td><strong>" + SKU + "</strong> - " + ProductName + "</td> "; } } else { var productvariable = ProductVariableController.GetBySKU(SKU); if (productvariable != null) { var parent_product = ProductController.GetByID(Convert.ToInt32(productvariable.ProductID)); if (parent_product != null) { ProductName = parent_product.ProductTitle; if (string.IsNullOrEmpty(productvariable.Image)) { ProductImage = parent_product.ProductImage; } else { ProductImage = productvariable.Image; } } Print += "<td><image src=\"" + ProductImage + "\" /></td>"; Print += "<td><p><strong>" + SKU + "</strong> - " + ProductName + "</p></td> "; } } Print += "<td>" + item.Quantity + "</td>"; Print += "<td>" + string.Format("{0:N0}", ItemPrice) + "</td>"; Print += "<td>" + string.Format("{0:N0}", SoldPrice) + "</td>"; Print += "<td>" + string.Format("{0:N0}", RefundFee) + "</td>"; Print += "<td>" + string.Format("{0:N0}", SubTotal) + "</td>"; Print += "</tr>"; TotalFee += Convert.ToInt32(item.RefundFeePerProduct) * Convert.ToInt32(item.Quantity); TotalOrder += SubTotal; if (t % 10 == 0) { if (t == print * 10) { continue; } Print += "</tbody>"; Print += "</table>"; Print += "</div>"; Print += "</div>"; Print += "</div>"; Print += "</div>"; Print += "<div class=\"print-order-image\">"; Print += "<div class=\"all print print-" + print + "\">"; Print += "<div class=\"body\">"; Print += "<div class=\"table-2\">"; Print += "<table>"; Print += "<colgroup>"; Print += "<col class=\"order-item\" />"; Print += "<col class=\"image\" />"; Print += "<col class=\"name\" />"; Print += "<col class=\"quantity\" />"; Print += "<col class=\"price\" />"; Print += "<col class=\"sold-price\" />"; Print += "<col class=\"fee\" />"; Print += "<col class=\"subtotal\"/>"; Print += "</colgroup>"; Print += "<thead>"; Print += "<th>#</th>"; Print += "<th>Hình ảnh</th>"; Print += "<th>Sản phẩm</th>"; Print += "<th>SL</th>"; Print += "<th>Giá niêm yết</th>"; Print += "<th>Giá đã bán</th>"; Print += "<th>Phí đổi hàng</th>"; Print += "<th>Tổng</th>"; Print += "</thead>"; Print += "<tbody>"; print++; } } } }
public void LoadData() { int ID = Request.QueryString["id"].ToInt(0); if (ID > 0) { var order = RefundGoodController.GetByID(ID); if (order != null) { string error = ""; string Print = ""; double TotalQuantity = 0; double TotalOrder = 0; double TotalFee = 0; var orderdetails = RefundGoodDetailController.GetByRefundGoodsID(ID); if (orderdetails.Count > 0) { printItemList(ref ID, ref TotalQuantity, ref TotalOrder, ref Print, ref TotalFee); string productPrint = ""; string shtml = ""; productPrint += "<div class=\"body\">"; productPrint += "<div class=\"table-1\">"; productPrint += "<h1>ĐƠN HÀNG ĐỔI TRẢ #" + order.ID + "</h1>"; productPrint += "<div class=\"note\">"; productPrint += "<p>- Miễn phí đổi size hoặc đổi hàng lỗi (cùng mẫu và cùng màu như lúc đầu).</p>"; productPrint += "<p>- Tính phí 15.000đ/cái nếu đổi sang sản phẩm khác bất kỳ.</p>"; productPrint += "<p>- Giá đã bán nếu nhỏ hơn giá niêm yết là do lúc bán ra có trừ chiết khấu.</p>"; productPrint += "<p>- Chúng tôi chỉ đổi hàng mà không hoàn tiền đơn hàng trả.</p>"; productPrint += "<p>- Đơn hàng đổi trả sẽ được trừ tiền vào đơn hàng mua sau đó.</p>"; productPrint += "<p>- Lưu ý hình ảnh sản phẩm trên đơn hàng có thể hiển thị không đúng.</p>"; productPrint += "<p>- Nếu có sai sót, quý khách có thể gọi điện thoại để thông báo cho nhân viên.</p>"; productPrint += "</div>"; productPrint += "<table>"; productPrint += "<colgroup >"; productPrint += "<col class=\"col-left\"/>"; productPrint += "<col class=\"col-right\"/>"; productPrint += "</colgroup>"; productPrint += "<tbody>"; productPrint += "<tr>"; productPrint += "<td>Khách hàng</td>"; productPrint += "<td class=\"customer-name\">" + order.CustomerName + "</td>"; productPrint += "</tr>"; productPrint += "<tr>"; productPrint += "<td>Điện thoại</td>"; productPrint += "<td>" + order.CustomerPhone + "</td>"; productPrint += "</tr>"; productPrint += "<tr>"; productPrint += "<td>Ngày tạo</td>"; string date = string.Format("{0:dd/MM/yyyy HH:mm}", order.CreatedDate); productPrint += "<td>" + date + "</td>"; productPrint += "</tr>"; productPrint += "</tr>"; productPrint += "<tr>"; productPrint += "<td>Nhân viên</td>"; productPrint += "<td>" + order.CreatedBy + "</td>"; productPrint += "</tr>"; if (!string.IsNullOrEmpty(order.RefundNote)) { productPrint += "<tr>"; productPrint += "<td>Ghi chú</td>"; productPrint += "<td>" + order.RefundNote + "</td>"; productPrint += "</tr>"; } productPrint += "</tbody>"; productPrint += "</table>"; productPrint += "</div>"; productPrint += "<div class=\"table-2\">"; productPrint += "<table>"; productPrint += "<colgroup>"; productPrint += "<col class=\"order-item\" />"; productPrint += "<col class=\"image\" />"; productPrint += "<col class=\"name\" />"; productPrint += "<col class=\"quantity\" />"; productPrint += "<col class=\"price\" />"; productPrint += "<col class=\"sold-price\" />"; productPrint += "<col class=\"fee\" />"; productPrint += "<col class=\"subtotal\"/>"; productPrint += "</colgroup>"; productPrint += "<thead>"; productPrint += "<th>#</th>"; productPrint += "<th>Hình ảnh</th>"; productPrint += "<th>Sản phẩm</th>"; productPrint += "<th>SL</th>"; productPrint += "<th>Giá niêm yết</th>"; productPrint += "<th>Giá đã bán</th>"; productPrint += "<th>Phí đổi hàng</th>"; productPrint += "<th>Tổng</th>"; productPrint += "</thead>"; productPrint += "<tbody>"; productPrint += Print; productPrint += "<tr>"; productPrint += "<td colspan=\"7\" class=\"align-right\">Số lượng</td>"; productPrint += "<td>" + TotalQuantity + "</td>"; productPrint += "</tr>"; productPrint += "<tr>"; productPrint += "<td colspan=\"7\" class=\"align-right\">Thành tiền</td>"; productPrint += "<td>" + string.Format("{0:N0}", TotalOrder) + "</td>"; productPrint += "</tr>"; productPrint += "<td colspan=\"7\" class=\"align-right\">Phí đổi hàng</td>"; productPrint += "<td>" + string.Format("{0:N0}", TotalFee) + "</td>"; productPrint += "</tr>"; double TotalPrice = TotalOrder; if (TotalPrice != Convert.ToDouble(order.TotalPrice)) { error += "Đơn hàng tính sai tổng tiền"; } productPrint += "<tr>"; productPrint += "<td class=\"strong align-right\" colspan=\"7\">TỔNG CỘNG (Đã trừ phí đổi hàng)</td>"; productPrint += "<td class=\"strong\">" + string.Format("{0:N0}", TotalOrder) + "</td>"; productPrint += "</tr>"; productPrint += "</tbody>"; productPrint += "</table>"; productPrint += "</div>"; productPrint += "</div>"; string dateOrder = string.Format("{0:dd/MM/yyyy HH:mm}", order.CreatedDate); shtml += "<div class=\"print-order-image\">"; shtml += "<div class=\"all print print-0\">"; shtml += "<div class=\"head\">"; string address = ""; string phone = ""; var agent = AgentController.GetByID(Convert.ToInt32(order.AgentID)); if (agent != null) { address = agent.AgentAddress; phone = agent.AgentPhone; } shtml += "<div class=\"logo\"><img src=\"App_Themes/Ann/image/logo.png\" /></div>"; shtml += "<div class=\"info\">"; shtml += "<div class=\"ct\">"; shtml += "<div class=\"ct-title\"></div>"; shtml += "<div class=\"ct-detail\"> " + address + "</div>"; shtml += "</div>"; shtml += "<div class=\"ct\">"; shtml += "<div class=\"ct-title\"> </div>"; shtml += "<div class=\"ct-detail\"> " + phone + "</div>"; shtml += "</div>"; shtml += "</div>"; shtml += "</div>"; shtml += productPrint; shtml += "</div>"; shtml += "</div>"; if (error != "") { ltrPrintInvoice.Text = "Xảy ra lỗi: " + error; } else { ltrPrintInvoice.Text = shtml; } } } else { ltrPrintInvoice.Text = "Không tìm thấy đơn hàng " + ID; } } else { ltrPrintInvoice.Text = "Xảy ra lỗi!!!"; } }
public void LoadData() { string username = Request.Cookies["usernameLoginSystem"].Value; var acc = AccountController.GetByUsername(username); if (acc != null) { int AgentID = Convert.ToInt32(acc.AgentID); int ID = Request.QueryString["id"].ToInt(0); if (ID > 0) { ViewState["ID"] = ID; var r = RefundGoodController.GetByIDAndAgentID(ID, AgentID); if (r != null) { ltrOrderID.Text = ID.ToString(); ltrCreateBy.Text = r.CreatedBy; ltrCreateDate.Text = r.CreatedDate.ToString(); ltrOrderStatus.Text = PJUtils.RefundStatus(Convert.ToInt32(r.Status)); ltrOrderQuantity.Text = r.TotalQuantity.ToString(); ltrOrderTotalPrice.Text = string.Format("{0:N0}", (Convert.ToDouble(r.TotalPrice))); ltrTotalRefundFee.Text = r.TotalRefundFee; ltrInfo.Text += "<div class=\"row\">"; ltrInfo.Text += "<div class=\"col-md-6\">"; ltrInfo.Text += "<div class=\"form-group\">"; ltrInfo.Text += "<label>Họ tên</label>"; ltrInfo.Text += "<span class=\"form-control\">" + r.CustomerName + "</span>"; ltrInfo.Text += "</div>"; ltrInfo.Text += "</div>"; ltrInfo.Text += "<div class=\"col-md-6\">"; ltrInfo.Text += "<div class=\"form-group\">"; ltrInfo.Text += "<label>Điện thoại</label>"; ltrInfo.Text += "<span class=\"form-control\">" + r.CustomerPhone + "</span>"; ltrInfo.Text += "</div>"; ltrInfo.Text += "</div>"; ltrInfo.Text += "</div>"; var cus = CustomerController.GetByID(r.CustomerID.Value); if (cus != null) { ltrInfo.Text += "<div class=\"row\">"; ltrInfo.Text += "<div class=\"col-md-6\">"; ltrInfo.Text += "<div class=\"form-group\">"; ltrInfo.Text += "<label>Nick đặt hàng</label>"; ltrInfo.Text += "<span class=\"form-control\">" + cus.Nick + "</span>"; ltrInfo.Text += "</div>"; ltrInfo.Text += "</div>"; ltrInfo.Text += "<div class=\"col-md-6\">"; ltrInfo.Text += "<div class=\"form-group\">"; ltrInfo.Text += "<label>Địa chỉ</label>"; ltrInfo.Text += "<span class=\"form-control\">" + cus.CustomerAddress + "</span>"; ltrInfo.Text += "</div>"; ltrInfo.Text += "</div>"; ltrInfo.Text += "</div>"; ltrInfo.Text += "<div class=\"row\">"; ltrInfo.Text += "<div class=\"col-md-6\">"; ltrInfo.Text += "<div class=\"form-group\">"; ltrInfo.Text += "<label>Zalo</label>"; ltrInfo.Text += "<span class=\"form-control\">" + cus.Zalo + "</span>"; ltrInfo.Text += "</div>"; ltrInfo.Text += "</div>"; ltrInfo.Text += "<div class=\"col-md-6\">"; ltrInfo.Text += "<div class=\"form-group\">"; ltrInfo.Text += "<label>Facebook</label>"; ltrInfo.Text += "<span class=\"form-control\">" + cus.Facebook + "</span>"; ltrInfo.Text += "</div>"; ltrInfo.Text += "</div>"; ltrInfo.Text += "</div>"; ltrInfo.Text += "<div class=\"row\">"; ltrInfo.Text += " <div class=\"col-md-12 view-detail\">"; ltrInfo.Text += " <a href=\"javascript:;\" class=\"btn primary-btn fw-btn not-fullwidth\" onclick=\"viewCustomerDetail('"+ cus.ID + "')\"><i class=\"fa fa-address-card-o\" aria-hidden=\"true\"></i> Xem chi tiết</a>"; ltrInfo.Text += " </div>"; ltrInfo.Text += "</div>"; } ltrTotal.Text = string.Format("{0:N0}", Convert.ToDouble(r.TotalPrice)); ltrQuantity.Text = string.Format("{0:N0}", Convert.ToDouble(r.TotalQuantity)); ltrRefund.Text = string.Format("{0:N0}", Convert.ToDouble(r.TotalRefundFee)); var rds = RefundGoodDetailController.GetByRefundGoodsID(ID); if (rds.Count > 0) { string html = ""; foreach (var item in rds) { html += "<tr class=\"product-result\" data-sku=\"" + item.SKU + "\" data-orderID=\"" + item.OrderID + "\" data-ProductName=\"" + item.ProductName + "\" data-ProductType=\"" + item.ProductType + "\" data-Giagoc=\"" + item.GiavonPerProduct + "\" data-Giadaban=\"" + item.SoldPricePerProduct + "\" data-TienGiam=\"" + item.DiscountPricePerProduct + "\" data-Soluongtoida=\"" + item.QuantityMax + "\" data-RefundFee=\"" + item.RefundFeePerProduct + "\" >"; html += " <td>" + item.OrderID + "</td>"; html += " <td>" + item.ProductName + "</td>"; html += " <td>" + item.SKU + "</td>"; html += " <td class=\"giagoc\" data-giagoc=\"" + item.GiavonPerProduct + "\">" + string.Format("{0:N0}", Convert.ToDouble(item.GiavonPerProduct)) + "</td>"; html += " <td class=\"giadaban\" data-giadaban=\"" + item.SoldPricePerProduct + "\">" + item.SoldPricePerProduct + " ( CK: " + string.Format("{0:N0}", Convert.ToDouble(item.DiscountPricePerProduct)) + ")</td>"; html += " <td class=\"sltoida\" data-soluongtoida=\"" + item.QuantityMax + "\">" + item.QuantityMax + "</td>"; html += " <td class=\"slcandoi\">" + item.Quantity + "</td>"; html += " <td>"; int refundType = Convert.ToInt32(item.RefundType); string refuntTypeName = ""; if (item.RefundType == 1) { refuntTypeName = "Đổi size"; } else if (item.RefundType == 2) { refuntTypeName = "Đổi sản phẩm khác"; } else { refuntTypeName = "Đổi hàng lỗi"; } html += refuntTypeName; html += " </td>"; html += " <td class=\"phidoihang\">" + string.Format("{0:N0}", Convert.ToDouble(item.RefundFeePerProduct)) + "</td>"; html += " <td class=\"thanhtien\">" + string.Format("{0:N0}", Convert.ToDouble(item.TotalPriceRow)) + "</td>"; html += "</tr>"; } ddlRefundStatus.SelectedValue = r.Status.ToString(); txtRefundsNote.Text = r.RefundNote; ltrList.Text = html; } } } } }
public void LoadData() { int n; if (String.IsNullOrEmpty(Request.QueryString["id"]) || !int.TryParse(Request.QueryString["id"], out n)) { PJUtils.ShowMessageBoxSwAlertError("Không tìm thấy đơn hàng", "e", true, "/danh-sach-don-tra-hang", Page); } string username = Request.Cookies["usernameLoginSystem"].Value; var acc = AccountController.GetByUsername(username); if (acc != null) { int AgentID = Convert.ToInt32(acc.AgentID); int ID = Request.QueryString["id"].ToInt(0); if (ID > 0) { ViewState["ID"] = ID; var r = RefundGoodController.GetByIDAndAgentID(ID, AgentID); if (r == null) { PJUtils.ShowMessageBoxSwAlertError("Không tìm thấy đơn hàng " + ID, "e", true, "/danh-sach-don-tra-hang", Page); } else { if (acc.RoleID != 0) { // Kiểm tra nếu đơn hàng này không "chính chủ" if (r.CreatedBy != acc.Username) { // Kiểm tra đơn hàng này có đang được tạo giúp bởi nhân viên khác không? var usernameRequest = HttpContext.Current.Request["username"]; if (!String.IsNullOrEmpty(usernameRequest)) { var userRequest = AccountController.GetByUsername(usernameRequest); if (userRequest == null) { PJUtils.ShowMessageBoxSwAlertError("Không tìm thấy nhân viên " + usernameRequest, "e", true, "/danh-sach-don-tra-hang", Page); } else { if (usernameRequest != r.CreatedBy) { PJUtils.ShowMessageBoxSwAlertError("Đơn hàng này không phải của " + usernameRequest, "e", true, "/danh-sach-don-tra-hang", Page); } else { if (r.UserHelp != acc.Username) { PJUtils.ShowMessageBoxSwAlertError("Đơn hàng này không phải do bạn tạo giúp", "e", true, "/danh-sach-don-tra-hang", Page); } else { PJUtils.ShowMessageBoxSwAlertError("Đơn hàng này do bạn tạo giúp. Nhấn OK để tiếp tục xử lý!", "i", false, "", Page); } } } } else { PJUtils.ShowMessageBoxSwAlertError("Đơn hàng này không phải của bạn", "e", true, "/danh-sach-don-tra-hang", Page); } } } ltrCreateBy.Text = r.CreatedBy; ltrCreateDate.Text = r.CreatedDate.ToString(); ltrOrderStatus.Text = PJUtils.RefundStatus(Convert.ToInt32(r.Status)); if (r.OrderSaleID > 0) { ltrOrderSaleID.Text = "<td><a class='customer-name-link' target='_blank' title='Bấm vào xem đơn hàng trừ tiền' href='/thong-tin-don-hang?id=" + r.OrderSaleID + "'>" + r.OrderSaleID + " (Xem đơn)</a>"; } else { ltrOrderSaleID.Text = ""; } ltrOrderQuantity.Text = r.TotalQuantity.ToString(); ltrOrderTotalPrice.Text = string.Format("{0:N0}", (Convert.ToDouble(r.TotalPrice))); ltrTotalRefundFee.Text = string.Format("{0:N0}", (Convert.ToDouble(r.TotalRefundFee))); ltrRefundNote.Text = r.RefundNote; int cusID = 0; string zalo = ""; string nick = ""; string address = ""; string facebook = ""; var cus = CustomerController.GetByID(r.CustomerID.Value); if (cus != null) { cusID = cus.ID; zalo = cus.Zalo; nick = cus.Nick; address = cus.CustomerAddress; facebook = cus.Facebook; hdfCustomerPhone.Value = cus.CustomerPhone; } // Title this.Title = String.Format("{0} - Đổi trả", string.IsNullOrEmpty(nick) ? nick.ToTitleCase() : r.CustomerName.ToTitleCase()); ltrHeading.Text = "Đơn đổi trả " + ID.ToString() + " - " + (string.IsNullOrEmpty(nick) ? nick.ToTitleCase() : r.CustomerName.ToTitleCase()) + (!string.IsNullOrEmpty(r.UserHelp) ? " (được tạo giúp bởi " + r.UserHelp + ")" : ""); ltrInfo.Text += "<div class='row'>"; ltrInfo.Text += " <div class='col-md-3'>"; ltrInfo.Text += " <div class='form-group'>"; ltrInfo.Text += " <label>Họ tên</label>"; ltrInfo.Text += " <span class='form-control input-disabled'>" + r.CustomerName + "</span>"; ltrInfo.Text += " </div>"; ltrInfo.Text += " </div>"; ltrInfo.Text += " <div class='col-md-3'>"; ltrInfo.Text += " <div class='form-group'>"; ltrInfo.Text += " <label>Điện thoại</label>"; ltrInfo.Text += " <span class='form-control input-disabled'>" + r.CustomerPhone + "</span>"; ltrInfo.Text += " </div>"; ltrInfo.Text += " </div>"; ltrInfo.Text += " <div class='col-md-3'>"; ltrInfo.Text += " <div class='form-group'>"; ltrInfo.Text += " <label>Nick đặt hàng</label>"; ltrInfo.Text += " <span class='form-control input-disabled'>" + nick + "</span>"; ltrInfo.Text += " </div>"; ltrInfo.Text += " </div>"; ltrInfo.Text += " <div class='col-md-3'>"; ltrInfo.Text += " <div class='form-group'>"; ltrInfo.Text += " <label>Facebook</label>"; ltrInfo.Text += " <span class='form-control input-disabled'>" + facebook + "</span>"; ltrInfo.Text += " </div>"; ltrInfo.Text += " </div>"; ltrInfo.Text += "</div> "; ltrInfo.Text += "<div class='row'>"; ltrInfo.Text += " <div class='col-md-3'>"; ltrInfo.Text += " <div class='form-group'>"; ltrInfo.Text += " <label>Tỉnh thành</label>"; ltrInfo.Text += " <select id='_ddlProvince' class='form-control' disable='true' readonly='readonly'></select>"; ltrInfo.Text += " </div>"; ltrInfo.Text += " </div>"; ltrInfo.Text += " <div class='col-md-3'>"; ltrInfo.Text += " <div class='form-group'>"; ltrInfo.Text += " <label>Quận huyện</label>"; ltrInfo.Text += " <select id='_ddlDistrict' class='form-control' disable='true' readonly='readonly'></select>"; ltrInfo.Text += " </div>"; ltrInfo.Text += " </div>"; ltrInfo.Text += " <div class='col-md-3'>"; ltrInfo.Text += " <div class='form-group'>"; ltrInfo.Text += " <label>Phường xã</label>"; ltrInfo.Text += " <select id='_ddlWard' class='form-control' disable='true' readonly='readonly'></select>"; ltrInfo.Text += " </div>"; ltrInfo.Text += " </div>"; ltrInfo.Text += " <div class='col-md-3'>"; ltrInfo.Text += " <div class='form-group'>"; ltrInfo.Text += " <label>Địa chỉ</label>"; ltrInfo.Text += " <span class='form-control input-disabled'>" + address + "</span>"; ltrInfo.Text += " </div>"; ltrInfo.Text += " </div>"; ltrInfo.Text += "</div>"; ltrInfo.Text += "<div class='form-row view-detail'>"; ltrInfo.Text += " <a href='javascript:;' class='btn primary-btn fw-btn not-fullwidth' onclick='viewCustomerDetail(`" + cusID + "`)'><i class='fa fa-address-card-o' aria-hidden='true'></i> Xem</a>"; ltrInfo.Text += "</div>"; #region Thông tin phí đổi tra double feeRefundDefault = 0; var discount = DiscountCustomerController.getbyCustID(cusID).FirstOrDefault(); if (discount != null) { feeRefundDefault = discount.FeeRefund; ltrInfo.Text += "<div class='form-row discount-info'>"; ltrInfo.Text += String.Format(" <strong>* Chiết khấu của khách: {0:0,0}/cái. (đơn từ {1:N0} cái)</strong>", discount.DiscountAmount, discount.QuantityProduct); ltrInfo.Text += "</div>"; } else { var config = ConfigController.GetByTop1(); feeRefundDefault = config.FeeChangeProduct.Value; } var refundPromotion = RefundGoodController.getPromotion(cusID); if (refundPromotion.IsPromotion) { feeRefundDefault = (feeRefundDefault - refundPromotion.DecreasePrice) < 0 ? 0 : feeRefundDefault - refundPromotion.DecreasePrice; } ltrInfo.Text += "<div class='form-row refund-info'>"; if (feeRefundDefault == 0) { ltrInfo.Text += " <strong>* Miễn phí đổi hàng</strong>"; } else { ltrInfo.Text += String.Format(" <strong>* Phí đổi trả hàng: {0:0,0}/cái.</strong>", feeRefundDefault); } ltrInfo.Text += "</div>"; if (UserController.checkExists(cusID)) { ltrInfo.Text += "<div class='form-row refund-info'>"; ltrInfo.Text += " <strong class='font-green'>Đã đăng ký App</strong>"; ltrInfo.Text += "</div>"; } else { ltrInfo.Text += "<div class='form-row refund-info'>"; ltrInfo.Text += " <strong class='font-red'>Chưa đăng ký App</strong>"; ltrInfo.Text += "</div>"; } #endregion ltrTotal.Text = string.Format("{0:N0}", Convert.ToDouble(r.TotalPrice)); ltrQuantity.Text = string.Format("{0:N0}", Convert.ToDouble(r.TotalQuantity)); ltrRefund.Text = string.Format("{0:N0}", Convert.ToDouble(r.TotalRefundFee)); // get info tranfor page tao-don-hang-doi-tra.aspx _refundGood.RefundGoodsID = ID; _refundGood.CustomerID = r.CustomerID.Value; _refundGood.CustomerName = r.CustomerName; _refundGood.CustomerPhone = r.CustomerPhone; _refundGood.CustomerNick = cus != null ? cus.Nick : String.Empty; _refundGood.CustomerAddress = cus != null ? cus.CustomerAddress : String.Empty; _refundGood.CustomerZalo = cus != null ? cus.Zalo : String.Empty; _refundGood.CustomerFacebook = cus != null ? cus.Facebook : String.Empty; _refundGood.RefundDetails = RefundGoodDetailController.GetInfoShowRefundDetail(ID, feeRefundDefault); _refundGood.TotalPrice = Convert.ToDouble(r.TotalPrice); _refundGood.TotalQuantity = Convert.ToDouble(r.TotalQuantity); _refundGood.TotalFreeRefund = Convert.ToDouble(r.TotalRefundFee); _refundGood.Status = r.Status.Value; _refundGood.Note = txtRefundsNote.Text; _refundGood.CreateBy = r.CreatedBy; var rds = RefundGoodDetailController.GetByRefundGoodsID(ID); var product = _refundGood.RefundDetails .Join( rds, p1 => new { RefundGoodsID = p1.RefundGoodsID, RefundDetailID = p1.RefundDetailID }, p2 => new { RefundGoodsID = p2.RefundGoodsID.Value, RefundDetailID = p2.ID }, (p1, p2) => new { p1, p2 }) .Select(x => new { SKU = x.p2.SKU, OrderID = x.p2.OrderID, ProductName = x.p2.ProductName, ProductType = x.p2.ProductType, GiavonPerProduct = x.p2.GiavonPerProduct, SoldPricePerProduct = x.p2.SoldPricePerProduct, DiscountPricePerProduct = x.p2.DiscountPricePerProduct, Quantity = x.p2.Quantity, QuantityMax = x.p2.QuantityMax, RefundType = x.p2.RefundType, RefundFeePerProduct = x.p2.RefundFeePerProduct, TotalPriceRow = x.p2.TotalPriceRow, ProductImage = x.p1.ProductImage }) .ToList(); if (product.Count > 0) { string html = ""; int t = 0; foreach (var item in product) { var variables = ProductVariableValueController.GetByProductVariableSKU(item.SKU); string variable = ""; if (variables.Count > 0) { variable += "<br><br>"; foreach (var v in variables) { variable += v.VariableName.Trim() + ": " + v.VariableValue.Trim() + "<br>"; } } t++; html += "<tr ondblclick='clickrow($(this))' class='product-result' data-sku='" + item.SKU + "' data-orderID='" + item.OrderID + "' data-ProductName='" + item.ProductName + "' data-ProductType='" + item.ProductType + "' data-Giagoc='" + item.GiavonPerProduct + "' data-Giadaban='" + item.SoldPricePerProduct + "' data-TienGiam='" + item.DiscountPricePerProduct + "' data-Soluongtoida='" + item.QuantityMax + "' data-RefundFee='" + item.RefundFeePerProduct + "'>"; html += " <td>" + t + "</td>"; html += " <td class='image-item'><img src='" + Thumbnail.getURL(item.ProductImage, Thumbnail.Size.Small) + "'></td>"; html += " <td class='name-item'><a href='/xem-san-pham?sku=" + item.SKU + "' target='_blank'>" + item.ProductName + "</a>" + variable + "</td>"; html += " <td class='sku-item'>" + item.SKU + "</td>"; html += " <td class='price-item giagoc' data-giagoc='" + item.GiavonPerProduct + "'>" + string.Format("{0:N0}", Convert.ToDouble(item.GiavonPerProduct)) + "</td>"; html += " <td class='giadaban' data-giadaban='" + item.SoldPricePerProduct + "'><strong>" + string.Format("{0:N0}", Convert.ToDouble(item.SoldPricePerProduct)) + "</strong><br>(CK: " + string.Format("{0:N0}", Convert.ToDouble(item.DiscountPricePerProduct)) + ")</td>"; html += " <td class='slcandoi'>" + item.Quantity + "</td>"; html += " <td>"; int refundType = Convert.ToInt32(item.RefundType); string refuntTypeName = ""; if (item.RefundType == 1) { refuntTypeName = "Đổi size"; } else if (item.RefundType == 2) { refuntTypeName = "Đổi sản phẩm khác"; } else if (item.RefundType == 4) { refuntTypeName = "Đổi sản phẩm khác (miễn phí)"; } else { refuntTypeName = "Đổi hàng lỗi"; } html += refuntTypeName; html += " </td>"; html += " <td class='phidoihang'>" + string.Format("{0:N0}", Convert.ToDouble(item.RefundFeePerProduct)) + "</td>"; html += " <td class='thanhtien'>" + string.Format("{0:N0}", Convert.ToDouble(item.TotalPriceRow)) + "</td>"; html += "</tr>"; } ddlRefundStatus.SelectedValue = r.Status.ToString(); txtRefundsNote.Text = r.RefundNote; ltrList.Text = html; } ltrPrint.Text = "<a href='/print-invoice-return?id=" + ID + "' target='_blank' class='btn primary-btn fw-btn not-fullwidth'><i class='fa fa-print' aria-hidden='true'></i> In hóa đơn</a>"; ltrPrint.Text += "<a href='/print-return-order-image?id=" + ID + "' target='_blank' class='btn primary-btn btn-blue fw-btn not-fullwidth print-invoice-merged'><i class='fa fa-picture-o' aria-hidden='true'></i> Lấy ảnh đơn hàng</a>"; } } } }
public void LoadData() { int ID = Request.QueryString["id"].ToInt(0); if (ID > 0) { var order = RefundGoodController.GetByID(ID); if (order != null) { string error = ""; string Print = ""; double TotalQuantity = 0; double TotalOrder = 0; var orderdetails = RefundGoodDetailController.GetByRefundGoodsID(ID); if (orderdetails.Count > 0) { printItemList(ref ID, ref TotalQuantity, ref TotalOrder, ref Print); string productPrint = ""; string shtml = ""; productPrint += "<div class=\"body\">"; productPrint += "<div class=\"table-1\">"; productPrint += "<h1 class=\"invoice-return\">HÓA ĐƠN ĐỔI TRẢ HÀNG #" + order.ID + "</h1>"; productPrint += "<table>"; productPrint += "<colgroup >"; productPrint += "<col class=\"col-left\"/>"; productPrint += "<col class=\"col-right\"/>"; productPrint += "</colgroup>"; productPrint += "<tbody>"; productPrint += "<tr>"; productPrint += "<td>Khách hàng</td>"; productPrint += "<td>" + order.CustomerName + "</td>"; productPrint += "</tr>"; productPrint += "<tr>"; productPrint += "<td>Điện thoại</td>"; productPrint += "<td>" + order.CustomerPhone + "</td>"; productPrint += "</tr>"; productPrint += "<tr>"; productPrint += "</tr>"; productPrint += "<tr>"; productPrint += "<td>Ngày tạo</td>"; string date = string.Format("{0:dd/MM/yyyy HH:mm}", order.CreatedDate); productPrint += "<td>" + date + "</td>"; productPrint += "</tr>"; productPrint += "<tr>"; productPrint += "<td>Nhân viên</td>"; productPrint += "<td>" + order.CreatedBy + "</td>"; productPrint += "</tr>"; productPrint += "<tr>"; productPrint += "<td>Trạng thái</td>"; if (order.Status == 0) { productPrint += "<td>Chưa trừ tiền</td>"; } else { productPrint += "<td>Đã trừ tiền</td>"; } productPrint += "</tr>"; if (!string.IsNullOrEmpty(order.RefundNote)) { productPrint += "<tr>"; productPrint += "<td>Ghi chú</td>"; productPrint += "<td>" + order.RefundNote + "</td>"; productPrint += "</tr>"; } productPrint += "</tbody>"; productPrint += "</table>"; productPrint += "</div>"; productPrint += "<div class=\"table-2 print-invoice-return\">"; productPrint += "<table>"; productPrint += "<colgroup>"; productPrint += "<col class=\"sanpham\" />"; productPrint += "<col class=\"soluong\" />"; productPrint += "<col class=\"gia\" />"; productPrint += "<col class=\"gia\" />"; productPrint += "<col class=\"tong\"/>"; productPrint += "</colgroup>"; productPrint += "<thead>"; productPrint += "<th>Sản phẩm</th>"; productPrint += "<th>SL</th>"; productPrint += "<th>Giá</th>"; productPrint += "<th>Phí</th>"; productPrint += "<th>Tổng</th>"; productPrint += "</thead>"; productPrint += "<tbody>"; productPrint += Print; productPrint += "<tr>"; productPrint += "<td colspan=\"4\">Số lượng</td>"; productPrint += "<td>" + TotalQuantity + "</td>"; productPrint += "</tr>"; if (TotalOrder != Convert.ToDouble(order.TotalPrice)) { error += "Đơn hàng tính sai tổng tiền"; } productPrint += "<tr>"; productPrint += "<td class=\"strong\" colspan=\"4\">Tổng tiền</td>"; productPrint += "<td class=\"strong\">" + string.Format("{0:N0}", TotalOrder) + "</td>"; productPrint += "</tr>"; productPrint += "<tr>"; productPrint += "<td colspan=\"4\">Phí đổi hàng</td>"; productPrint += "<td>" + string.Format("{0:N0}", Convert.ToDouble(order.TotalRefundFee)) + "</td>"; productPrint += "</tr>"; productPrint += "</tbody>"; productPrint += "</table>"; productPrint += "</div>"; productPrint += "</div>"; shtml += "<div class=\"hoadon\">"; shtml += "<div class=\"all\">"; shtml += productPrint; shtml += "<div class=\"footer\"><h3>CẢM ƠN QUÝ KHÁCH !!!</h3>"; shtml += "<p>Lưu ý:</p>"; shtml += "<p>- Chúng tôi chỉ trả lại tiền mặt khi tổng tiền dưới 50.000đ.</p>"; shtml += "<p>- Đơn hàng đổi trả trên 50.000đ dùng để trừ tiền khi mua sản phẩm khác.</p>"; shtml += "<p>- Giá trên hóa đơn là giá bán ra đã trừ chiết khấu (nếu có).</p>"; shtml += "<p>- Phí đổi hàng áp dụng khi đổi hàng tồn hoặc đổi sang màu/mẫu khác.</p>"; shtml += "<p>- Miễn phí đổi size hoặc hàng lỗi cùng màu/mẫu như lúc đầu.</p>"; shtml += "</div>"; shtml += "</div>"; shtml += "</div>"; if (error != "") { ltrPrintInvoice.Text = "Xảy ra lỗi: " + error; ltrPrintEnable.Text = ""; } else { ltrPrintInvoice.Text = shtml; ltrPrintEnable.Text = "<div class=\"print-enable true\"></div>"; } } } else { ltrPrintInvoice.Text = "Không tìm thấy đơn hàng " + ID; } } else { ltrPrintInvoice.Text = "Xảy ra lỗi!!!"; } }