public string loadInventory(string branchType, string branchId, string fromdate, string todate) { string result = ""; string fDate = "", tDate = ""; if (fromdate.Trim() != "") { fDate = cl.returnDatetime(fromdate.Trim()); } if (todate.Trim() != "") { tDate = cl.returnDatetime(todate.Trim()); } var m = db.sp_web_ReportInventory(branchType, branchId, DateTime.Parse(fDate), DateTime.Parse(tDate)); int i = 1; foreach (var item in m.ToList()) { result += "<tr class='detail-rows' id='" + item.ProductId.ToString() + "' title='Click để xem chi tiết'>"; result += "<td class='center'>" + i.ToString() + "</td>"; result += "<td>" + item.BranchCode + "</td>"; result += "<td>" + item.BranchName + "</td>"; result += "<td>" + item.ProductId + "</td>"; result += "<td>" + item.ProductCode + "</td>"; result += "<td>" + item.ProductName + "</td>"; result += "<td class='center'>" + item.Pre + "</td>"; result += "<td class='center'>" + item.QuantityInput + "</td>"; result += "<td class='center'>" + item.QuantityOutput + "</td>"; result += "<td class='center'>" + item.Total + "</td>"; result += "</tr>"; i++; } return(result); }
public string loadBill(string branchType, string branchId, string fromdate, string todate, string outputType) { string result = ""; int i = 1; string fDate = "", tDate = ""; if (fromdate.Trim() != "") { fDate = cl.returnDatetime(fromdate.Trim()); } if (todate.Trim() != "") { tDate = cl.returnDatetime(todate.Trim()); } if (fDate == "" || tDate == "") { fDate = ""; tDate = ""; txtFromDate.Text = ""; txtToDate.Text = ""; } var m = db.sp_web_loadBill(branchType, branchId, fDate, tDate, outputType); foreach (var item in m.ToList()) { result += "<tr class='detail-rows' title='Click để xem chi tiết'>"; result += "<td class='center'><a href='#' class='btn btn-xs btn-success showchild' id='" + item.Id.ToString() + "'>Xem</a>"; if (item.OutputType.Equals("Xuất điều chuyển")) { result += " <a target='_blank' href='/printoutputstock/" + item.Id.ToString() + "' class='btn btn-xs btn-success'>In</a>"; } result += "</td>"; result += "<td>" + item.StockCode + "</td>"; result += "<td>" + item.OutputType + "</td>"; result += "<td>" + item.ObjectReceiver + "</td>"; result += "<td>" + item.ObjectName + "</td>"; result += "<td class='right'>" + (item.Total.Value > 999 ? string.Format("{0:0,0}", item.Total.Value) : item.Total.ToString()) + "</td>"; result += "<td class='center'>" + item.DiscountPercent.ToString() + "%</td>"; result += "<td class='right'>" + (item.TotalDiscount.Value > 999 ? string.Format("{0:0,0}", item.TotalDiscount.Value) : item.TotalDiscount.ToString()) + "</td>"; result += "<td class='right'>" + (item.TotalPrice.Value > 999 ? string.Format("{0:0,0}", item.TotalPrice.Value) : item.TotalPrice.ToString()) + "</td>"; result += "<td>" + item.Note + "</td>"; result += "<td>" + item.PaymentType + "</td>"; result += "<td class='center'>" + item.CreateAt.Value.ToString("dd/MM/yyyy") + "</td>"; result += "<td>" + item.FullName + "</td>"; result += "</tr>"; i++; } return(result); }
public string loadOrder(string branchType, string fromdate, string todate) { string result = ""; int i = 1; string fDate = "", tDate = ""; if (fromdate.Trim() != "") { fDate = cl.returnDatetime(fromdate.Trim()); } if (todate.Trim() != "") { tDate = cl.returnDatetime(todate.Trim()); } if (fDate == "" || tDate == "") { fDate = ""; tDate = ""; txtFromDate.Text = ""; txtToDate.Text = ""; } if (fDate != "" && tDate != "") { var m = db.sp_web_loadOrder(branchType, DateTime.Parse(fDate), DateTime.Parse(tDate)); foreach (var item in m.ToList()) { result += "<tr class='detail-rows' id='" + item.Id.ToString() + "' title='Click để xem chi tiết'>"; result += "<td class='center childrows'></td>"; result += "<td>" + item.BranchName + "</td>"; result += "<td>" + item.CreateAt + "</td>"; result += "<td>" + item.OrderCode + "</td>"; result += "<td>" + item.CustomerName + "</td>"; result += "<td>" + item.Phone + "</td>"; result += "<td>" + item.Email + "</td>"; result += "<td>" + item.Address + "</td>"; result += "<td>" + item.Note + "</td>"; result += "<td>" + item.Status + "</td>"; result += "</tr>"; i++; } } return(result); }
public string loadBill(string branchType, string branchId, string fromdate, string todate, string inputType) { string result = ""; int i = 1; string fDate = "", tDate = ""; if (fromdate.Trim() != "") { fDate = cl.returnDatetime(fromdate.Trim()); } if (todate.Trim() != "") { tDate = cl.returnDatetime(todate.Trim()); } if (fDate == "" || tDate == "") { fDate = ""; tDate = ""; txtFromDate.Text = ""; txtToDate.Text = ""; } var m = db.sp_web_InputStock(branchType, branchId, fDate, tDate, inputType); foreach (var item in m.ToList()) { result += "<tr class='detail-rows' title='Click để xem chi tiết'>"; result += "<td class='center'><a href='#' class='btn btn-xs btn-success showchild' id='" + item.Id.ToString() + "'>Xem</a> "; if (item.InputType.Equals("Nhập từ NCC")) { result += " <a target='_blank' href='/printinputstock/" + item.Id.ToString() + "' class='btn btn-xs btn-success'>In</a>"; } result += "</td>"; result += "<td>" + item.StockCode + "</td>"; result += "<td>" + item.InputType + "</td>"; result += "<td>" + item.ObjectReceiver + "</td>"; result += "<td>" + item.ObjectName + "</td>"; result += "<td class='center'>" + item.CreateAt.Value.ToString("dd/MM/yyyy") + "</td>"; result += "<td>" + item.FullName + "</td>"; result += "<td>" + item.Note + "</td>"; result += "</tr>"; i++; } return(result); }
public string loadBill(string branchType, string branchId, string fromdate, string todate) { string result = ""; string fDate = "", tDate = ""; if (fromdate.Trim() != "") { fDate = cl.returnDatetime(fromdate.Trim()); } if (todate.Trim() != "") { tDate = cl.returnDatetime(todate.Trim()); } var m = db.sp_web_loadInputStock(branchType, branchId, fDate, tDate); int i = 1; int count = 0; foreach (var item in m.ToList()) { result += "<tr class='detail-rows' id='" + item.Id.ToString() + "' title='Click để xem chi tiết'>"; result += "<td class='center childrows'></td>"; result += "<td>" + item.BranchCode + "</td>"; result += "<td>" + item.BranchName + "</td>"; result += "<td>" + item.CreateAt + "</td>"; result += "<td>" + item.FullName + "</td>"; result += "<td>" + item.StockCode + "</td>"; result += "<td>" + item.CodeId + "</td>"; result += "<td>" + item.ProductCode + "</td>"; result += "<td>" + item.ProductName + "</td>"; result += "<td>" + item.Quantity + "</td>"; result += "<td>" + item.UnitName + "</td>"; result += "<td>" + item.SupplierCode + "</td>"; result += "<td>" + item.SupplierName + "</td>"; result += "<td>" + item.SuppAddress + "</td>"; result += "<td>" + item.Note + "</td>"; result += "</tr>"; i++; count += item.Quantity.Value; } lbCount.Text = count == 0 ? "0" : string.Format("{0:0,0}", count); return(result); }
public static result check_register(string user, string name, string email, string pw, int sex, string phone, string birth, string add, string country, string countryname, string district, string districtname) { CNManagerDataContext db = new CNManagerDataContext(); clsProcess cl = new clsProcess(); var r = new result(); try { var mb = new tMember(); mb.Username = user.Trim(); mb.MemberCode = "MB" + DateTime.Now.ToString("ddMMyyyyHHmmss"); mb.MemberName = name.Trim(); mb.Email = email.Trim().ToLower(); mb.Password = cl.MaHoa(pw.Trim()); mb.Sex = sex == 1 ? true : false; mb.Phone = phone.Trim(); if (birth.Trim() != "") { mb.Birthday = DateTime.Parse(cl.returnDatetime(birth.Trim())); } mb.Address = add.Trim(); if (country != "") { mb.CountryId = int.Parse(country.Trim()); mb.CountryName = countryname; } if (district != "") { mb.DistrictId = int.Parse(district.Trim()); mb.DistrictName = districtname; } mb.BranchTypeId = branchTypeId; mb.Status = 1; mb.JoinCreateAt = DateTime.Now; mb.CreateAt = DateTime.Now; db.tMembers.InsertOnSubmit(mb); db.SubmitChanges(); r._mess = "Đăng kí tài khoản thành công"; r._content = "ok"; } catch (Exception ax) { r._content = "err"; r._mess = ax.Message; } return(r); }
public static result updateInfoMember(string name, string sex, string phone, string email, string birth) { var r = new result(); if (!string.IsNullOrEmpty(Convert.ToString(HttpContext.Current.Session["cn_mb_user_id"]))) { CNManagerDataContext db = new CNManagerDataContext(); clsProcess cl = new clsProcess(); var x = from n in db.tMembers where n.BranchTypeId == branchTypeId && n.Id == int.Parse(HttpContext.Current.Session["cn_mb_user_id"].ToString()) select n; if (x.Count() == 1) { x.FirstOrDefault().MemberName = name.Trim(); x.FirstOrDefault().Sex = sex.Trim() == "1" ? true : false; x.FirstOrDefault().Phone = phone.Trim(); x.FirstOrDefault().Email = email.Trim(); if (birth.Trim() != "") { x.FirstOrDefault().Birthday = DateTime.Parse(cl.returnDatetime(birth.Trim())); } else { x.FirstOrDefault().Birthday = null; } db.SubmitChanges(); r._mess = "Cập nhật thành công"; r._content = "ok"; } else { r._mess = "Không tìm thấy thông tin thành viên, vui lòng thử lại"; r._content = "error"; } } else { r._mess = "Hết phiên đăng nhập, vui lòng đăng nhập lại"; r._content = "error"; } return(r); }
public string loadForm() { string result = ""; int i = 1; string label = ""; var user_id = Session["cm_userId"].ToString(); string fdate = "", tdate = "", fromdate = "", todate = ""; if (txtFromDate.Text.Trim() != "") { fromdate = txtFromDate.Text.Trim(); } if (txtToDate.Text.Trim() != "") { todate = txtToDate.Text.Trim(); } if (fromdate != "" && todate != "") { fdate = cl.returnDatetime(fromdate); tdate = cl.returnDatetime(todate); } var m = db.sp_Gantt_load(user_id, dlUserReceiver.SelectedValue, dlStatus.SelectedValue, fdate, tdate); string comp = "", module = "", remove = "", complete = ""; foreach (var item in m.ToList()) { complete = ""; if (item.IdUserReceiver.ToString() == user_id && item.Status == 1 && item.ModuleId == null) { complete = "1"; } comp = ""; if (item.CompleteDate != null) { comp = item.CompleteDate.Value.ToString("dd/MM/yyyy"); } module = ""; if (item.ModuleId != null) { module = item.ModuleId.ToString(); } remove = ""; if (item.IdUser.ToString() == user_id && item.ModuleId == null && item.Status == 1) { remove = "1"; } result += "<tr id='job" + item.Id.ToString() + "' data-toggle='modal' data-target='#updateJob' onclick='update_modal(\"" + item.Id.ToString() + "\",\"" + item.CreateBy + "\",\"" + item.IdUser + "\",\"" + user_id + "\",\"" + item.CreateAt.Value.ToString("dd/MM/yyyy") + "\",\"" + item.StartDate.Value.ToString("dd/MM/yyyy") + "\",\"" + item.ExpectDate.Value.ToString("dd/MM/yyyy") + "\",\"" + comp + "\",\"" + item.FullName + "\",\"" + item.Name + "\",\"" + item.Note + "\",\"" + item.Comment + "\",\"" + item.Status + "\",\"" + module + "\",\"" + remove + "\",\"" + complete + "\");' class='detail-rows' title='Click để xem chi tiết'>"; result += "<td class='center'><label class='label label-warning'>Xem</label></td>"; if (item.Status.Value == 1) { label = "blink label label-success"; } else if (item.Status.Value == 2) { label = "label label-primary"; } else { label = "label label-danger"; } result += "<td><label class='" + label + "'>" + item.StatusName + "</label></td>"; result += "<td>" + item.CreateBy + "</td>"; result += "<td>" + item.FullName + "</td>"; result += "<td>" + item.Name + "</td>"; result += "<td>" + item.StartDate.Value.ToString("dd/MM/yyyy") + "</td>"; result += "<td>" + item.ExpectDate.Value.ToString("dd/MM/yyyy") + "</td>"; if (item.CompleteDate != null) { result += "<td>" + item.CompleteDate.Value.ToString("dd/MM/yyyy") + "</td>"; } else { result += "<td></td>"; } result += "<td>" + item.Data + "</td>"; result += "<td>" + item.Comment + "</td>"; result += "<td>" + item.Note + "</td>"; result += "</tr>"; i++; } return(result); }
public static List <product> mb_getproductBuy(string from, string to) { var p = new List <product>(); if (!string.IsNullOrEmpty(Convert.ToString(HttpContext.Current.Session["cn_mb_user_id"]))) { CNManagerDataContext db = new CNManagerDataContext(); clsProcess cl = new clsProcess(); string userid = HttpContext.Current.Session["cn_mb_user_id"].ToString(); int count = 0; var n = db.sp_web_cn_mb_getproductBuy(int.Parse(userid), DateTime.Parse(cl.returnDatetime(from)), DateTime.Parse(cl.returnDatetime(to))); foreach (var item in n.ToList()) { count++; var x = new product(); x.BranchName = item.BranchName; x.Brand = item.Brand; x.Code = item.ProductCode; x.CodeOrder = item.OrderCode; x.ID = item.ProductId.ToString(); x.CreateAt = item.CreateAt.Value.ToString("dd/MM/yyyy hh:mm:ss"); x.Image = item.Image; x.Name = item.ProductName; x.TotalPrice = string.Format("{0:0,0 đ}", item.TotalPrice.Value); x.Price = string.Format("{0:0,0 đ}", item.Price.Value); x.pScore = item.Score.ToString(); x.Quantity = item.Quantity.ToString(); x.OK = true; x.Mess = ""; x.Status = cl.ConvertToUnSign(item.ProductName); p.Add(x); } if (count == 0) { p.Add(new product { OK = false, Mess = "Không có dữ liệu nào phù hợp" }); } } else { p.Add(new product { OK = false, Mess = "Phiên đăng nhập hết hạn, vui lòng đăng nhập lại" }); } return(p); }
public string loadBill(string branchType, string branchId, string fromdate, string todate) { string outputType = "1";//xuat ban, 2//dieu chuyen string result = "", product = ""; int i = 1; string fDate = "", tDate = ""; if (fromdate.Trim() != "") { fDate = cl.returnDatetime(fromdate.Trim()); } if (todate.Trim() != "") { tDate = cl.returnDatetime(todate.Trim()); } if (fDate == "" || tDate == "") { fDate = ""; tDate = ""; } //var m = db.sp_web_loadBill(branchType, branchId, fDate, tDate, outputType); var m = db.sp_web_ReportRevenue(branchType.Trim(), branchId.Trim(), DateTime.Parse(fDate), DateTime.Parse(tDate)); double total_discount = 0, total_revenue = 0; foreach (var item in m.ToList()) { total_discount += item.TotalDiscount.Value; total_revenue += item.TotalPrice.Value; result += "<tr class='detail-rows' title='Click để xem chi tiết'>"; result += "<td class='center childrows'></td>"; result += "<td>" + item.BranchCode + "</td>"; result += "<td>" + item.BranchName + "</td>"; result += "<td>" + item.CreateAt.Value.ToString("dd/MM/yyyy HH:mm:ss") + "</td>"; result += "<td>" + item.StockCode + "</td>"; result += "<td>" + item.MemberCode + "</td>"; result += "<td>" + item.MemberName + "</td>"; result += "<td>" + item.Username + "</td>"; result += "<td>" + item.FullName + "</td>"; result += "<td>" + item.CreateBy + "</td>"; result += "<td>" + (item.Total.Value > 999 ? string.Format("{0:0,0}", item.Total.Value) : item.Total.ToString()) + "</td>"; result += "<td>" + item.DiscountPercent.ToString() + " %</td>"; result += "<td>" + (item.TotalDiscount.Value > 999 ? string.Format("{0:0,0}", item.TotalDiscount.Value) : item.TotalDiscount.ToString()) + "</td>"; if (item.TotalPrice.Value < 0) { result += "<td>" + ((item.TotalPrice.Value * (-1)) > 999 ? string.Format("{0:0,0}", item.TotalPrice.Value) : item.TotalPrice.Value.ToString()) + "</td>"; } else { result += "<td>" + (item.TotalPrice.Value > 999 ? string.Format("{0:0,0}", item.TotalPrice.Value) : item.TotalPrice.ToString()) + "</td>"; } result += "<td>" + (item.CustomePay > 999 ? string.Format("{0:0,0}", item.CustomePay) : item.CustomePay.ToString()) + "</td>"; result += "<td>" + (item.CustomeReturn > 999 ? string.Format("{0:0,0}", item.CustomeReturn) : item.CustomeReturn.ToString()) + "</td>"; result += "<td>" + item.Note + "</td>"; result += "</tr>"; i++; } //result += "<tr><td colspan='5'>Tổng chiết khấu: " + string.Format("{0:0,0}", total_discount) + "</td><td colspan='12'>Tổng doanh thu: " + string.Format("{0:0,0}", total_revenue) + "</td></tr>"; lbTongTien.Text = total_revenue == 0 ? "0" : string.Format("{0:0,0 đ}", total_revenue); return(result); }
public string loadBill(string branchType, string branchId, string fromdate, string todate) { string result = ""; int i = 1; string fDate = "", tDate = ""; if (fromdate.Trim() != "") { fDate = cl.returnDatetime(fromdate.Trim()); } if (todate.Trim() != "") { tDate = cl.returnDatetime(todate.Trim()); } if (fDate == "" || tDate == "") { fDate = ""; tDate = ""; } //var m = db.sp_web_loadBill(branchType, branchId, fDate, tDate, outputType); var m = db.sp_web_baocaoxuathang(branchType.Trim(), branchId.Trim(), fDate, tDate, int.Parse(rdPaymentType.SelectedValue)); double total_revenue = 0; int count = 0; string code = ""; var tmp1 = new Dictionary <string, double>(); foreach (var item in m.ToList()) { if (code != item.StockCode) { count++; code = item.StockCode; } result += "<tr class='detail-rows' id='" + item.Id.ToString() + "' title='Click để xem chi tiết'>"; result += "<td class='center childrows'></td>"; result += "<td>" + item.BranchCode + "</td>"; result += "<td>" + item.BranchName + "</td>"; result += "<td>" + item.CreateAt + "</td>"; result += "<td>" + item.StockCode + "</td>"; result += "<td>" + item.MemberCode + "</td>"; result += "<td>" + item.MemberName + "</td>"; result += "<td>" + item.Address + "</td>"; result += "<td>" + item.Phone + "</td>"; result += "<td>" + item.FullName + "</td>"; result += "<td>" + item.Code + "</td>"; result += "<td>" + item.Name + "</td>"; result += "<td>" + item.ProductCode + "</td>"; result += "<td>" + item.ProductName + "</td>"; result += "<td>" + item.UnitName + "</td>"; result += "<td>" + item.Quantity.ToString() + "</td>"; result += "<td>" + string.Format("{0:0,0}", item.Price.Value) + "</td>"; result += "<td>" + item.DiscountPercent.ToString() + " %</td>"; if (item.Discount.Value > 999) { result += "<td>" + string.Format("{0:0,0}", item.Discount) + "</td>"; } else { result += "<td>" + item.Discount.ToString() + "</td>"; } result += "<td>" + string.Format("{0:0,0}", item.TotalPrice) + "</td>"; if (!tmp1.ContainsKey(item.StockCode)) { result += "<td>" + string.Format("{0:0,0}", item.TTPrice) + "</td>"; result += "<td>" + item.TotalDiscountPercent.ToString() + " %</td>"; if (item.TotalDiscount > 999) { result += "<td>" + string.Format("{0:0,0}", item.TotalDiscount) + "</td>"; } else { result += "<td>" + item.TotalDiscount.ToString() + "</td>"; } result += "<td>" + (item.Total_Price == 0 ? "0" : string.Format("{0:0,0}", item.Total_Price)) + "</td>"; result += "<td>" + (item.CustomePay == 0 ? "0" : string.Format("{0:0,0}", item.CustomePay)) + "</td>"; result += "<td>" + (item.CustomeReturn == 0 ? "0" : string.Format("{0:0,0}", item.CustomeReturn)) + "</td>"; result += "<td>" + item.PaymentType + "</td>"; result += "<td>" + item.Note + "</td>"; tmp1.Add(item.StockCode, item.TTPrice.Value); total_revenue += item.Total_Price.Value; } else { result += "<td>--</td><td>--</td><td>--</td><td>--</td><td>--</td><td>--</td><td>--</td><td>--</td>"; } result += "</tr>"; i++; } lbCount.Text = count < 999 ? count.ToString() : string.Format("{0:0,0}", count); lbTongTien.Text = total_revenue == 0 ? "0" : string.Format("{0:0,0 đ}", total_revenue); return(result); }