private void BindOtherData() { //string strSqlWhere = ""; //DynamicParameters dynamicParams = new DynamicParameters(); //strSqlWhere = " PostCode=@PostCode"; //dynamicParams.Add("PostCode", luePostcode.EditValue); var lstPcs = new SQLiteDbHelper().QueryMultiByWhere <TaPostcodeSetInfo>("Ta_Postcode_Set", "", null); var lstTmpPcs = from pcs in CommonData.TaPostcodeSet select new { pcID = pcs.ID, pcPostcode = pcs.PostCode, pcAddr = pcs.PCAddr, pcZone = pcs.PCZone, pcDist = pcs.PCDist }; gridControlPostcode.Visible = true; gridControlPostcode.Size = gridControlCustomer.Size; gridControlPostcode.Location = new Point(gridControlCustomer.Location.X, gridControlCustomer.Location.Y); gridControlPostcode.DataSource = lstTmpPcs; (gridControlPostcode.DefaultView as GridView)?.BestFitColumns(); gvPostcode.ClearColumnsFilter(); }
public static bool Add(DataTable dt) { if (dt == null || dt.Rows.Count == 0 || dt.Columns.Count == 0) { return(false); } //INSERT INTO [Job]()VALUES(); StringBuilder fields_sb = new StringBuilder(); StringBuilder values_sb = new StringBuilder(); StringBuilder value_sb = new StringBuilder(); //先确定字段 foreach (DataColumn col in dt.Columns) { fields_sb.Append(col.ColumnName + ","); } fields_sb.Remove(fields_sb.Length - 1, 1); //确定值 foreach (DataRow row in dt.Rows) { value_sb.Clear(); foreach (DataColumn col in dt.Columns) { value_sb.Append("'" + row[col].ToString() + "',"); } value_sb.Remove(value_sb.Length - 1, 1); values_sb.AppendLine("(" + value_sb + "),"); } return(SQLiteDbHelper.ExecuteNonQuery( string.Format("INSERT INTO [Job]\n({0})\nVALUES\n{1}" , fields_sb.ToString(), values_sb.ToString().Trim().TrimEnd(','))) > 0); }
public static void CreateTestDb(string connectionString) { const string sql = @" CREATE TABLE 'tblBlogs' ('id' INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL , 'url' TEXT, 'name' TEXT, 'thumbnail' BLOB, 'NumberOfPosts' INTEGER, 'AddDate' DATETIME); CREATE TABLE 'tblReports' ('id' INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL , 'PdfRpt' BLOB, 'AddDate' DATETIME); CREATE TABLE 'tblParents' ('Id' INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 'BirthDate' DATETIME, 'Name' TEXT, 'LastName' TEXT); CREATE TABLE 'tblKids' ('Id' INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 'ParentId' INTEGER, 'BirthDate' DATETIME, 'Name' TEXT); "; SQLiteDbHelper.ExecSQL(connectionString, sql); }
private void btnChangePayment_Click(object sender, EventArgs e) { //new SystemData().GetTaOrderItem(); //TaCheckOrderInfo taCheckOrderInfo = CommonData.TaCheckOrder.FirstOrDefault(s => s.CheckCode.Equals(strChkOrder) && s.BusDate.Equals(checkBusDate)); string strSqlWhere = ""; DynamicParameters dynamicParams = new DynamicParameters(); strSqlWhere = "CheckCode=@CheckCode AND BusDate=@BusDate"; dynamicParams.Add("CheckCode", strChkOrder); dynamicParams.Add("BusDate", checkBusDate); TaCheckOrderInfo taCheckOrderInfo = new SQLiteDbHelper().QueryFirstByWhere <TaCheckOrderInfo>("Ta_CheckOrder", strSqlWhere, dynamicParams); FrmTaPaymentShop frmTaPaymentShop = new FrmTaPaymentShop(usrID, strChkOrder, sOrderType, SetPrtInfo(CommonData.TaOrderItem.Where(s => s.CheckCode.Equals(strChkOrder) && s.BusDate.Equals(checkBusDate)).ToList()), checkBusDate, taCheckOrderInfo); frmTaPaymentShop.ShowDialog(); GetBindData("", true, false); }
private void btnAssignDriver_Click(object sender, EventArgs e) { if (gvTaPendOrder.FocusedRowHandle < 0) { return; } //new SystemData().GetTaCheckOrder(); var lstRec = CommonData.TaCheckOrder.Where(s => s.ID == Convert.ToInt32(gvTaPendOrder.GetRowCellValue(gvTaPendOrder.FocusedRowHandle, "ID").ToString()) && s.BusDate.Equals(checkBusDate)); if (lstRec.Any()) { TaCheckOrderInfo taCheckOrderInfo = lstRec.FirstOrDefault(); taCheckOrderInfo.DriverID = Convert.ToInt32(lueDriver.EditValue); //DelegateSaveCheckOrder handler = DelegateMy.SaveCheckOrder; //IAsyncResult result = handler.BeginInvoke(taCheckOrderInfo, true,null, null); CommonDAL.SaveOrUpdateCheckOrder(taCheckOrderInfo); //_control.UpdateEntity(taCheckOrderInfo); } string strSqlWhere = ""; DynamicParameters dynamicParams = new DynamicParameters(); strSqlWhere = "BusDate=@BusDate"; dynamicParams.Add("BusDate", checkBusDate); List <ShowAndPendOrderDataInfo> lstTmp = new SQLiteDbHelper().QueryMultiByWhere <ShowAndPendOrderDataInfo>("VIEW_ShowAndPendOrder", strSqlWhere, dynamicParams); GetBindData(lstTmp, "", 0, false); }
private void btnPanelOrder_Click(object sender, EventArgs e) { //var btn = (PanelControl)sender; var btn = (LabelControl)sender; int iNum = Convert.ToInt32(btn.Name.Replace("lblOrderNo", "")); //new SystemData().GetTaCheckOrder(); //var lstCo = CommonData.TaCheckOrder.Where(s => s.CheckCode.Equals(lblOderNo[iNum - 1].Text)); string strSqlWhere = ""; DynamicParameters dynamicParams = new DynamicParameters(); strSqlWhere = " CheckCode=@CheckCode AND BusDate=@BusDate"; dynamicParams.Add("BusDate", strBustDate); dynamicParams.Add("CheckCode", lblOderNo[iNum - 1].Text); var lstCo = new SQLiteDbHelper().QueryMultiByWhere <TaCheckOrderInfo>("Ta_CheckOrder", strSqlWhere, dynamicParams); if (lstCo.Any()) { TaCheckOrderInfo taCheckOrderInfo = lstCo.FirstOrDefault(); FrmTaMain frmTaMain = new FrmTaMain(lblOderNo[iNum - 1].Text, taCheckOrderInfo.StaffID, Convert.ToInt32(taCheckOrderInfo.CustomerID), strBustDate, true); this.Hide(); frmTaMain.ShowDialog(); } else { FrmTaPendOrder frmTaPendOrder = new FrmTaPendOrder(lblOderNo[iNum - 1].Text, strBustDate, txtTelNum.Text); this.Hide(); frmTaPendOrder.ShowDialog(); } }
protected void Page_Load(object sender, EventArgs e) { PublishJobTable.GetPublishedJobTable_All(); this.DgvGdh.DataSource = SQLiteDbHelper.ExecuteDataTable( sqlSelect + " ORDER BY [Excel时间] DESC LIMIT 300"); this.DgvGdh.DataBind(); }
private void RefreshPrtInfo() { if (string.IsNullOrEmpty(strChkOrder)) return; if (doc == null) doc = new HtmlWeb().Load(WbPrtStatic.PRT_TEMPLATE_FILE_PATH + @"so" + WbPrtStatic.PRT_TEMPLATE_FILE_NAME_SUFFIX); string strSqlWhere = ""; DynamicParameters dynamicParams = new DynamicParameters(); strSqlWhere = "CheckCode=@CheckCode AND BusDate=@BusDate"; dynamicParams.Add("CheckCode", strChkOrder); dynamicParams.Add("BusDate", strBusDate); var lstOI = new SQLiteDbHelper().QueryMultiByWhere<TaOrderItemInfo>("Ta_OrderItem", strSqlWhere, dynamicParams); //new SystemData().GetTaOrderItem(); //var lstOI = CommonData.TaOrderItem.Where(s => s.CheckCode.Equals(strChkOrder) && s.BusDate.Equals(strBusDate)).ToList(); WbPrtTemplataTa wbPrtTemplataTa = new WbPrtTemplataTa(); wbPrtTemplataTa = GetAllPrtInfo(); string htmlText = doc.Text; if (string.IsNullOrEmpty(htmlText)) webBrowser1.DocumentText = ""; htmlText = WbPrtPrint.ReplaceHtmlPrtKeysShop(htmlText, wbPrtTemplataTa); htmlText = WbPrtPrint.GetOrderItemInfo(doc, htmlText, lstOI, false); webBrowser1.DocumentText = htmlText; //webBrowser2.Refresh(); }
private void FrmTaPendOrder_Load(object sender, EventArgs e) { //CommonDAL.ShowMessage(this); //SystemData systemData = new SystemData(); //systemData.GetTaCheckOrder(); //systemData.GetTaCustomer(); //systemData.GetUsrBase(); //systemData.GetTaOrderItem(); //systemData.GetShowAndPendOrderData("", strBusDate); //System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); //sw.Start(); //new SystemData().GetShowAndPendOrderData("", strBusDate); //GetBindData("", 0, false); //sw.Stop(); //TimeSpan ts = sw.Elapsed; //Console.WriteLine(@"FrmTaPendOrder_Load Time " + ts.TotalMilliseconds); System.Diagnostics.Stopwatch sw1 = new System.Diagnostics.Stopwatch(); sw1.Start(); string strSqlWhere = ""; DynamicParameters dynamicParams = new DynamicParameters(); strSqlWhere = "BusDate=@BusDate"; dynamicParams.Add("BusDate", strBusDate); List <ShowAndPendOrderDataInfo> lstTmp = new SQLiteDbHelper().QueryMultiByWhere <ShowAndPendOrderDataInfo>("VIEW_ShowAndPendOrder", strSqlWhere, dynamicParams); GetBindData(lstTmp, "", 0, false); sw1.Stop(); TimeSpan ts1 = sw1.Elapsed; Console.WriteLine(@"FrmTaPendOrder_Load Time1:" + ts1.TotalMilliseconds); LogHelper.Info(@"FrmTaPendOrder_Load Time1:" + ts1.TotalMilliseconds); BinLueDriver(); //异步刷新CheckOrder和OrderItem //DelegateRefresh hd = DelegateMy.RefreshSomeInfo; //IAsyncResult rt = hd.BeginInvoke("3", strBusDate, "", null, null); asfc.controllInitializeSize(this); //CommonDAL.HideMessage(this); }
private void btnNotPaid_Click(object sender, EventArgs e) { string strSqlWhere = ""; DynamicParameters dynamicParams = new DynamicParameters(); strSqlWhere = "BusDate=@BusDate"; dynamicParams.Add("BusDate", checkBusDate); List <ShowAndPendOrderDataInfo> lstTmp = new SQLiteDbHelper().QueryMultiByWhere <ShowAndPendOrderDataInfo>("VIEW_ShowAndPendOrder", strSqlWhere, dynamicParams); GetBindData(lstTmp, "", 0, false); }
private void btnPrtKit_Click(object sender, EventArgs e) { #region 原打印方式 //new SystemData().GetTaOrderItem(); //var lstOI = CommonData.TaOrderItem.Where(s => s.CheckCode.Equals(strChkOrder) && s.BusDate.Equals(deDay.Text)).ToList(); //PrtTemplataTa prtTemplataTa = new PrtTemplataTa(); //prtTemplataTa.RestaurantName = PrtCommon.GetRestName(); //prtTemplataTa.Addr = PrtCommon.GetRestAddr(); //prtTemplataTa.Telephone = PrtCommon.GetRestTel(); //prtTemplataTa.VatNo = PrtCommon.GetRestVATNo(); //prtTemplataTa.OrderTime = PrtCommon.GetPrtTime(); //prtTemplataTa.OrderDate = PrtCommon.GetPrtDateTime(); //prtTemplataTa.OrderNo = strChkOrder; //prtTemplataTa.PayType = GetPayType(strChkOrder); //prtTemplataTa.TotalAmount = sTotalAmount; //prtTemplataTa.SubTotal = sSubTotal; //prtTemplataTa.StaffName = sStaff; //prtTemplataTa.ItemCount = sItemCount >= 1 ? sItemCount.ToString() : "0"; //prtTemplataTa.Discount = sDiscount + sDiscountPer; //PrtTemplate.PrtTa(prtTemplataTa, lstOI, PrtStatic.PRT_TEMPLATE_TA_KITCHEN_TYPE); #endregion Stopwatch sw = new Stopwatch(); sw.Start(); //new SystemData().GetTaOrderItem(); //var lstOI = CommonData.TaOrderItem.Where(s => s.CheckCode.Equals(strChkOrder) && s.BusDate.Equals(checkBusDate)).ToList(); string strSqlWhere = ""; DynamicParameters dynamicParams = new DynamicParameters(); strSqlWhere = "CheckCode=@CheckCode AND BusDate=@BusDate"; dynamicParams.Add("CheckCode", strChkOrder); dynamicParams.Add("BusDate", checkBusDate); var lstOI = new SQLiteDbHelper().QueryMultiByWhere <TaOrderItemInfo>("Ta_OrderItem", strSqlWhere, dynamicParams); WbPrtTemplataTa wbPrtTemplataTa = new WbPrtTemplataTa(); wbPrtTemplataTa = GetAllPrtInfo(); //WbPrtPrint.PrintHtml( WbPrtStatic.PRT_CLASS_KITCHEN, lstOI, wbPrtTemplataTa, sOrderType); DelegatePrtHtml handler = DelegateMy.PrtHtml; IAsyncResult result = handler.BeginInvoke(WbPrtStatic.PRT_CLASS_KITCHEN, lstOI, wbPrtTemplataTa, sOrderType, null, null); sw.Stop(); TimeSpan ts = sw.Elapsed; Console.WriteLine(@"#btnPrtKit_Click# Time:{0}", ts.TotalMilliseconds); }
private string GetPayType(string sCheckOrder, string sBusDate) { //new SystemData().GetTaCheckOrder(); //var lstChk = CommonData.TaCheckOrder.Where(s => s.CheckCode.Equals(sChkId) && s.BusDate.Equals(deDay.Text)); string strSqlWhere = ""; DynamicParameters dynamicParams = new DynamicParameters(); strSqlWhere = "CheckCode=@CheckCode AND BusDate=@BusDate"; dynamicParams.Add("CheckCode", sCheckOrder); dynamicParams.Add("BusDate", sBusDate); var lstChk = new SQLiteDbHelper().QueryMultiByWhere <TaCheckOrderInfo>("Ta_CheckOrder", strSqlWhere, dynamicParams); string strPt = "Paid By "; if (lstChk.Any()) { TaCheckOrderInfo taCheckOrder = lstChk.FirstOrDefault(); if (Convert.ToDecimal(taCheckOrder.PayTypePay1) > 0) { strPt += taCheckOrder.PayType1 + " "; } if (Convert.ToDecimal(taCheckOrder.PayTypePay2) > 0) { strPt += taCheckOrder.PayType2 + " "; } if (Convert.ToDecimal(taCheckOrder.PayTypePay3) > 0) { strPt += taCheckOrder.PayType3 + " "; } if (Convert.ToDecimal(taCheckOrder.PayTypePay4) > 0) { strPt += taCheckOrder.PayType4 + " "; } if (Convert.ToDecimal(taCheckOrder.PayTypePay5) > 0) { strPt += taCheckOrder.PayType5 + " "; } } return(strPt); }
private TaCustomerInfo GetCustInfo(string custPhone) { //new SystemData().GetTaCustomer(); //var lstCust = CommonData.TaCustomer.Where(s => s.cusPhone.Equals(custPhone)); string strSqlWhere = ""; DynamicParameters dynamicParams = new DynamicParameters(); strSqlWhere = "cusPhone=@cusPhone"; dynamicParams.Add("cusPhone", custPhone); List <TaCustomerInfo> lstCust = new SQLiteDbHelper().QueryMultiByWhere <TaCustomerInfo>("Ta_Customer", strSqlWhere, dynamicParams); return(lstCust.Any() ? lstCust.FirstOrDefault() : null); }
private void RefreshPrtInfo(string sBusDate, string sCheckCode) { Stopwatch sw = new Stopwatch(); sw.Start(); if (string.IsNullOrEmpty(sCheckCode)) { return; } if (doc == null) { doc = new HtmlWeb().Load(WbPrtStatic.PRT_TEMPLATE_FILE_PATH + @"so" + WbPrtStatic.PRT_TEMPLATE_FILE_NAME_SUFFIX); } string strSqlWhere = ""; DynamicParameters dynamicParams = new DynamicParameters(); strSqlWhere = "CheckCode=@CheckCode AND BusDate=@BusDate"; dynamicParams.Add("BusDate", sBusDate); dynamicParams.Add("CheckCode", sCheckCode); //var lstOI = CommonData.TaOrderItem.Where(s => s.CheckCode.Equals(strChkOrder) && s.BusDate.Equals(checkBusDate)).ToList(); var lstOI = new SQLiteDbHelper().QueryMultiByWhere <TaOrderItemInfo>("Ta_OrderItem", strSqlWhere, dynamicParams); string htmlText = doc.Text; wbPtl = GetAllPrtInfo(); if (string.IsNullOrEmpty(htmlText)) { webBrowser2.DocumentText = ""; } htmlText = WbPrtPrint.ReplaceHtmlPrtKeysShop(htmlText, wbPtl); htmlText = WbPrtPrint.GetOrderItemInfo(doc, htmlText, lstOI, false); webBrowser2.DocumentText = htmlText; sw.Stop(); TimeSpan ts = sw.Elapsed; Console.WriteLine(@"FrmTaShowOrder/RefreshPrtInfo Time:{0}", ts.TotalMilliseconds); //webBrowser2.Refresh(); }
private static void IsNotExistCreate() { SQLiteDbHelper.ExecuteNonQuery( " CREATE TABLE IF NOT EXISTS [Job] (" + "[ID] integer NOT NULL PRIMARY KEY AUTOINCREMENT, " + "[稿袋号] nvarchar(254) NOT NULL DEFAULT '', " + "[上机机台] nvarchar(254) NOT NULL DEFAULT '', " + "[客户简称] nvarchar(254) NOT NULL DEFAULT '', " + "[产品名称] nvarchar(254) NOT NULL DEFAULT '', " + "[制造尺寸] nvarchar(254) NOT NULL DEFAULT '', " + "[面纸尺寸] nvarchar(254) NOT NULL DEFAULT '', " + "[色数1] nvarchar(254) NOT NULL DEFAULT '', " + "[色数2] nvarchar(254) NOT NULL DEFAULT '', " + "[晒版数] nvarchar(254) NOT NULL DEFAULT '', " + "[备注] nvarchar(254) NOT NULL DEFAULT '', " + "[咬口] nvarchar(254) NOT NULL DEFAULT '', " + "[Excel文件] nvarchar(254) NOT NULL DEFAULT '', " + "[Excel时间] nvarchar(254) NOT NULL DEFAULT '');"); }
private void SetPanelCustInfo() { pcCust1.Click += btnPanelCustInfo_Click; pcCust2.Click += btnPanelCustInfo_Click; pcCust3.Click += btnPanelCustInfo_Click; pcCust4.Click += btnPanelCustInfo_Click; pcCust5.Click += btnPanelCustInfo_Click; pcCust6.Click += btnPanelCustInfo_Click; pcCust7.Click += btnPanelCustInfo_Click; pcCust8.Click += btnPanelCustInfo_Click; lblCustPhone1.Click += btnPanelCustPhone_Click; lblCustPhone2.Click += btnPanelCustPhone_Click; lblCustPhone3.Click += btnPanelCustPhone_Click; lblCustPhone4.Click += btnPanelCustPhone_Click; lblCustPhone5.Click += btnPanelCustPhone_Click; lblCustPhone6.Click += btnPanelCustPhone_Click; lblCustPhone7.Click += btnPanelCustPhone_Click; lblCustPhone8.Click += btnPanelCustPhone_Click; string strSqlWhere = ""; DynamicParameters dynamicParams = new DynamicParameters(); strSqlWhere = "BusDate=@BusDate"; dynamicParams.Add("BusDate", strBustDate); List <TaComePhoneInfo> lstCp = new SQLiteDbHelper().QueryMultiByWhere <TaComePhoneInfo>("Ta_ComePhone", strSqlWhere, dynamicParams); int i = 0; //new SystemData().GetComePhoneInfo(); //foreach (var tcpi in CommonData.TaComePhoneInfo.Where(s => s.BusDate.Equals(strBustDate)).OrderByDescending(s => s.ID).Take(8)) foreach (var tcpi in lstCp.OrderByDescending(s => s.ID).Take(8)) { pcCust[i].Visible = true; lblCustInfo[i].Text = tcpi.ComePhoneTime; lblCustPhone[i].Text = tcpi.CustPhoneNo; i++; } }
private bool IsExitCustInfo(string strPhone) { try { string strSqlWhere = ""; DynamicParameters dynamicParams = new DynamicParameters(); strSqlWhere = "cusPhone=@cusPhone"; dynamicParams.Add("cusPhone", strPhone); var lstTaCust = new SQLiteDbHelper().QueryMultiByWhere <TaCustomerInfo>("Ta_Customer", strSqlWhere, dynamicParams); return(lstTaCust.Any()); } catch (Exception ex) { LogHelper.Error(this.Name, ex); return(false); } }
private void btnChangePayment_Click(object sender, EventArgs e) { string strSqlWhere = ""; DynamicParameters dynamicParams = new DynamicParameters(); strSqlWhere = "CheckCode=@CheckCode AND BusDate=@BusDate"; dynamicParams.Add("CheckCode", strChkOrder); dynamicParams.Add("BusDate", checkBusDate); TaCheckOrderInfo taCheckOrderInfo = new SQLiteDbHelper().QueryFirstByWhere <TaCheckOrderInfo>("Ta_CheckOrder", strSqlWhere, dynamicParams); //new SystemData().GetTaOrderItem(); //TaCheckOrderInfo taCheckOrderInfo = CommonData.TaCheckOrder.FirstOrDefault(s => s.CheckCode.Equals(strChkOrder) && s.BusDate.Equals(checkBusDate)); if (taCheckOrderInfo != null) { dynamicParams = new DynamicParameters(); strSqlWhere = "CheckCode=@CheckCode AND BusDate=@BusDate"; dynamicParams.Add("CheckCode", strChkOrder); dynamicParams.Add("BusDate", deDay.Text); var lstOI = new SQLiteDbHelper().QueryMultiByWhere <TaOrderItemInfo>("Ta_OrderItem", strSqlWhere, dynamicParams); FrmTaPaymentShop frmTaPaymentShop = new FrmTaPaymentShop(usrID, strChkOrder, sOrderType, SetPrtInfo(lstOI), checkBusDate, taCheckOrderInfo); frmTaPaymentShop.Location = panelControl4.Location; frmTaPaymentShop.Size = panelControl4.Size; frmTaPaymentShop.ShowDialog(); GetBindData(deDay.Text); } }
protected void ButtonSearch_Click(object sender, EventArgs e) { PublishJobTable.GetPublishedJobTable_All(); string searchTxt = this.TextBoxSearch.Text.Trim(); if (!string.IsNullOrWhiteSpace(searchTxt)) { // StringBuilder sb = new StringBuilder(); // DataTable tempDt = SQLiteDbHelper.ExecuteDataTable("SELECT [ID],[稿袋号],[客户简称],[产品名称]FROM[Job]"); // foreach (DataRow row in tempDt.Select(string.Format("[客户简称] LIKE '%{0}%' OR[产品名称] LIKE '%{0}%'OR[稿袋号] LIKE '%{0}%'", searchTxt.Trim()))) // { // sb.Append(row["ID"].ToString() + ","); // } // sb.Append(0); // this.DgvGdh.DataSource = SQLiteDbHelper.ExecuteDataTable( // sqlSelect + "WHERE[ID] IN (" + sb.ToString() + ")"); this.DgvGdh.DataSource = SQLiteDbHelper.ExecuteDataTable( string.Format(sqlSelect + " WHERE[客户简称] LIKE '%{0}%' OR[产品名称] LIKE '%{0}%' " + "OR[稿袋号] LIKE '%{0}%' ORDER BY [Excel时间] DESC LIMIT 300", searchTxt.Trim())); this.DgvGdh.DataBind(); } }
private void SetReadyTime() { if (!string.IsNullOrEmpty(txtTelNum.Text)) { //new SystemData().GetTaCustomer(); //TaCustomerInfo taCustomerInfo = new TaCustomerInfo(); //var lstCust = CommonData.TaCustomer.Where(s => s.cusPhone.Equals(txtTelNum.Text)); string strSqlWhere = ""; DynamicParameters dynamicParams = new DynamicParameters(); strSqlWhere = "cusPhone=@cusPhone"; dynamicParams.Add("cusPhone", txtTelNum.Text.Trim()); List <TaCustomerInfo> lstCust = new SQLiteDbHelper().QueryMultiByWhere <TaCustomerInfo>("Ta_Customer", strSqlWhere, dynamicParams); TaCustomerInfo taCustomerInfo = new TaCustomerInfo(); string strReadyTime = (!string.IsNullOrEmpty(txtHour.Text) && !string.IsNullOrEmpty(txtMinute.Text)) ? CommonDAL.SetAddZeroFront(txtHour.Text) + @":" + CommonDAL.SetAddZeroFront(txtMinute.Text) : " "; if (lstCust.Any()) { taCustomerInfo = lstCust.FirstOrDefault(); taCustomerInfo.cusReadyTime = strReadyTime; _control.UpdateEntity(taCustomerInfo); } else { taCustomerInfo.cusPhone = txtTelNum.Text.Trim(); taCustomerInfo.cusReadyTime = strReadyTime; _control.AddEntity(taCustomerInfo); } } }
/// <summary> /// 绑定初始数据 /// </summary> /// <param name="busDate">营业日</param> private void GetBindData(string busDate) { System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); sw.Start(); List <AccountSummaryInfo> lstDb = null; if (!string.IsNullOrEmpty(busDate)) { string strSqlWhere = ""; DynamicParameters dynamicParams = new DynamicParameters(); strSqlWhere = "BusDate=@BusDate"; dynamicParams.Add("BusDate", busDate); lstDb = new SQLiteDbHelper().QueryMultiByWhere <AccountSummaryInfo>("VIEW_AccountSummary", strSqlWhere, dynamicParams); } else { lstDb = new SQLiteDbHelper().QueryMultiByWhere <AccountSummaryInfo>("VIEW_AccountSummary", "", null); } //var lstDb = lstAccountSummaryInfos; gridControlTaShowOrder.DataSource = lstDb.ToList(); gvTaShowOrder.Columns["PayTime"].BestFit(); gvTaShowOrder.FocusedRowHandle = gvTaShowOrder.RowCount - 1; SetTxtContent(busDate); sw.Stop(); TimeSpan ts = sw.Elapsed; Console.WriteLine(@"FrmAccountSummary GetBindData Time:{0}", ts.TotalMilliseconds); LogHelper.Info(@"FrmAccountSummary GetBindData Time:" + ts.TotalMilliseconds); }
public static void GetPublishedJobTable_All() { DateTime excelLastTime = DateTime.MinValue; object obj = SQLiteDbHelper.ExecuteScalar("select max([Excel时间]) from job"); DataTable excelTable = SQLiteDbHelper.ExecuteDataTable("select Excel文件 from job group by excel文件"); if (obj != null) { DateTime.TryParse(obj.ToString(), out excelLastTime); } //检索Excel文件 FileInfo[] files = new DirectoryInfo(@"\\128.1.30.112\Downloads").GetFiles("*.xls"); foreach (FileInfo file in files) { //删除超过日期的信息 if (file.LastWriteTime < excelLastTime) { continue; } //判断Excel文件名是否存在 string excelFileName = Path.GetFileNameWithoutExtension(file.FullName); DataRow[] rows = excelTable.Select("[Excel文件]='" + excelFileName + "'"); //如果不存在,则添加 if (rows == null || rows.Length == 0) { //读取Excel里面的作业信息,并返回一个DataTable DataTable dt_excel = GetPublishDataTableFromExcelFile(file.FullName); if (dt_excel != null) { //添加 JobService.Add(dt_excel); } } } }
private void btnPrtKit_Click(object sender, EventArgs e) { string strSqlWhere = ""; DynamicParameters dynamicParams = new DynamicParameters(); strSqlWhere = "CheckCode=@CheckCode AND BusDate=@BusDate"; dynamicParams.Add("CheckCode", strChkOrder); dynamicParams.Add("BusDate", checkBusDate); var lstOI = new SQLiteDbHelper().QueryMultiByWhere <TaOrderItemInfo>("Ta_OrderItem", strSqlWhere, dynamicParams); //new SystemData().GetTaOrderItem(); //var lstOI = CommonData.TaOrderItem.Where(s => s.CheckCode.Equals(strChkOrder) && s.BusDate.Equals(checkBusDate)).ToList(); WbPrtTemplataTa wbPrtTemplataTa = new WbPrtTemplataTa(); wbPrtTemplataTa = GetAllPrtInfo(); //WbPrtPrint.PrintHtml( WbPrtStatic.PRT_CLASS_KITCHEN, lstOI, wbPrtTemplataTa, sOrderType); DelegatePrtHtml handler = DelegateMy.PrtHtml; IAsyncResult result = handler.BeginInvoke(WbPrtStatic.PRT_CLASS_KITCHEN, lstOI, wbPrtTemplataTa, sOrderType, null, null); }
private void btnOK_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(checkOrderId)) { return; } //if (string.IsNullOrEmpty(txtRefNum.Text)) return; try { //new SystemData().GetTaCheckOrder(); //var lstCo = CommonData.TaCheckOrder.Where(s => s.CheckCode.Equals(checkOrderId) && s.BusDate.Equals(strBusDate)); var lstCo = GetCheckOrderInfos(checkOrderId, strBusDate); if (lstCo.Any()) { TaCheckOrderInfo taCheckOrderInfo = lstCo.FirstOrDefault(); string strSqlWhere = ""; DynamicParameters dynamicParams = new DynamicParameters(); taCheckOrderInfo.RefNum = txtRefNum.Text; strSqlWhere = "ID=@ID"; bool isUpdate = new SQLiteDbHelper().Update <TaCheckOrderInfo>(@"Ta_CheckOrder", strSqlWhere, taCheckOrderInfo); //_control.UpdateEntity(taCheckOrderInfo); DialogResult = DialogResult.OK; Hide(); } } catch (Exception ex) { LogHelper.Error(this.Name, ex); } }
private void GetBindData(int iDriver) { string strSqlWhere = ""; DynamicParameters dynamicParams = new DynamicParameters(); strSqlWhere = "PayOrderType=@PayOrderType AND BusDate=@BusDate"; dynamicParams.Add("PayOrderType", PubComm.ORDER_TYPE_DELIVERY); dynamicParams.Add("BusDate", strBusDate); var lstCheck = new SQLiteDbHelper().QueryMultiByWhere <TaCheckOrderInfo>("Ta_CheckOrder", strSqlWhere, dynamicParams); //var lstCheck = CommonData.TaCheckOrder.Where(s => s.PayOrderType.Equals(PubComm.ORDER_TYPE_DELIVERY)); var lstDb = from check in lstCheck join driver in CommonData.TaDriver on check.DriverID equals driver.ID select new { ID = check.ID, CheckCode = check.CheckCode, OrderTime = check.PayTime, DeliveryFee = check.DeliveryFee, DriverID = check.DriverID, DriverName = string.IsNullOrEmpty(driver.DriverName) ? "" : driver.DriverName, }; gridControlTaDriver.DataSource = iDriver == 0 ? lstDb.ToList() : lstDb.Where(s => s.DriverID == iDriver).ToList(); gvTaPendOrder.FocusedRowHandle = gvTaPendOrder.RowCount - 1; gvTaPendOrder.BestFitColumns(); txtTotalDeliveryCharge.Text = iDriver == 0 ? lstDb.Sum(s => Convert.ToDecimal(s.DeliveryFee)).ToString("0.00") : lstDb.Where(s => s.DriverID == iDriver).Sum(s => Convert.ToDecimal(s.DeliveryFee)).ToString("0.00"); }
/// <summary> /// 绑定初始数据 /// </summary> /// <param name="orderType">账单类型</param> private void GetBindData(string orderType, bool isNeedStaff, bool isShowRefNum) { Stopwatch sw = new Stopwatch(); sw.Start(); //new SystemData().GetShowAndPendOrderData("", strBusDate); string strSqlWhere = ""; DynamicParameters dynamicParams = new DynamicParameters(); strSqlWhere = "IsPaid=@IsPaid AND BusDate=@BusDate"; //strSqlWhere = "IsPaid=@IsPaid"; dynamicParams.Add("IsPaid", "Y"); dynamicParams.Add("BusDate", strBusDate); if (!string.IsNullOrEmpty(orderType)) { strSqlWhere += " AND PayOrderType=@PayOrderType"; dynamicParams.Add("PayOrderType", orderType); } if (isShowRefNum) { strSqlWhere += " AND RefNum!=@RefNum"; dynamicParams.Add("RefNum", ""); } List <ShowAndPendOrderDataInfo> lst = new SQLiteDbHelper().QueryMultiByWhere <ShowAndPendOrderDataInfo>("VIEW_ShowAndPendOrder", strSqlWhere, dynamicParams); //var lstTmp = lst.Where(s => s.IsPaid.Equals(@"Y")); //var lstDb = from sPod in lst // select new // { // ID = sPod.ID, // gridOrderNo = sPod.CheckCode, // gridPayType = sPod.PayType.Trim(), // gridOrderType = sPod.PayOrderType, // gridOrderTime = sPod.PayTime, // gridTotal = sPod.TotalAmount, // gridDriver = sPod.DriverName, // //gridDriver = "", // gridStaff = sPod.UsrName, // gridCustID = sPod.CustID, // gridDiscountPer = sPod.PayPerDiscount, // gridDisount = sPod.PayDiscount, // gridSubTotal = sPod.MenuAmount, // gridBusDate = sPod.BusDate, // gridTendered = sPod.Paid, // gridChange = sPod.Change, // gridRefNo = sPod.RefNum, // gridDeliveryFee = sPod.DeliveryFee, // gridStaffId = sPod.StaffID, // gridSurcharge = sPod.PaySurcharge // }; gridControlTaShowOrder.DataSource = lst; sw.Stop(); TimeSpan ts = sw.Elapsed; Console.WriteLine(@"FrmTaShowOrder/GetBindData Time {0}", ts.TotalMilliseconds); gvTaShowOrder.Columns["PayTime"].BestFit(); gvTaShowOrder.FocusedRowHandle = gvTaShowOrder.RowCount - 1; }
private WbPrtTemplataTa GetAllPrtInfo() { WbPrtTemplataTa wbPrtTemplataTa = new WbPrtTemplataTa(); new SystemData().GetTaSysPrtSetGeneral(); var lstGen = CommonData.TaSysPrtSetGeneral; if (lstGen.Any()) { TaSysPrtSetGeneralInfo taSysPrtSetGeneralInfo = lstGen.FirstOrDefault(); //wbPrtTemplataTa.PrintAddress = taSysPrtSetGeneralInfo.IsPrtAddr; new SystemData().GetTaSysCtrl(); var lstTaSysCtrl = CommonData.TaSysCtrl; if (lstTaSysCtrl.Any()) { wbPrtTemplataTa.PrintAddress = lstTaSysCtrl.FirstOrDefault().ShopAddress; } wbPrtTemplataTa.PrintTel = taSysPrtSetGeneralInfo.TelNo; wbPrtTemplataTa.VATNo = taSysPrtSetGeneralInfo.VATNo; wbPrtTemplataTa.Msg1 = taSysPrtSetGeneralInfo.Msg1; wbPrtTemplataTa.Msg2 = taSysPrtSetGeneralInfo.Msg2; wbPrtTemplataTa.Msg3 = taSysPrtSetGeneralInfo.Msg3; wbPrtTemplataTa.Msg4 = taSysPrtSetGeneralInfo.Msg4; wbPrtTemplataTa.Msg5 = taSysPrtSetGeneralInfo.Msg5; } if (!string.IsNullOrEmpty(intCusID.ToString())) { new SystemData().GetTaCustomer(); var lstCust = CommonData.TaCustomer.Where(s => s.ID == intCusID); if (lstCust.Any()) { TaCustomerInfo taCustomerInfo = lstCust.FirstOrDefault(); wbPrtTemplataTa.CustName = taCustomerInfo.cusName; wbPrtTemplataTa.CustPhone = taCustomerInfo.cusPhone; wbPrtTemplataTa.CustDist = taCustomerInfo.cusDistance; wbPrtTemplataTa.CustMapRef = taCustomerInfo.cusPcZone; wbPrtTemplataTa.CustHouseNo = taCustomerInfo.cusHouseNo; wbPrtTemplataTa.CustAddr = taCustomerInfo.cusAddr; wbPrtTemplataTa.CustPostCode = taCustomerInfo.cusPostcode; wbPrtTemplataTa.ShopTime = taCustomerInfo.cusReadyTime; } } wbPrtTemplataTa.OrderDate = DateTime.Now.ToShortDateString(); wbPrtTemplataTa.OrderTime = DateTime.Now.ToShortTimeString(); wbPrtTemplataTa.Staff = string.IsNullOrEmpty(sStaff) ? CommonData.UsrBase.FirstOrDefault(s => s.ID == intStaffID).UsrName : sStaff; wbPrtTemplataTa.OrderNo = strChkOrder; wbPrtTemplataTa.ItemCount = sItemCount >= 1 ? sItemCount.ToString() : "0"; wbPrtTemplataTa.SubTotal = sSubTotal; wbPrtTemplataTa.Total = sTotalAmount; wbPrtTemplataTa.PayType = GetPayType(strChkOrder, deDay.Text); wbPrtTemplataTa.Tendered = sTendered; wbPrtTemplataTa.Change = string.IsNullOrEmpty(sChange) ? @"0.00" : (Convert.ToDecimal(sChange)).ToString("0.00"); wbPrtTemplataTa.OrderType = sOrderType; wbPrtTemplataTa.RefNo = sRefNo; wbPrtTemplataTa.DeliveryFee = sDeliveryFee; wbPrtTemplataTa.Discount = sDiscount; wbPrtTemplataTa.Surcharge = sSurcharge; #region VAT计算 if (CommonData.GenSet.Any()) { wbPrtTemplataTa.Rate1 = CommonData.GenSet.FirstOrDefault().VATPer + @"%"; //var lstVAT = from oi in CommonData.TaOrderItem.Where(s => s.CheckCode.Equals(strChkOrder) && s.BusDate.Equals(checkBusDate)) // join mi in CommonData.TaMenuItem on oi.ItemCode equals mi.MiDishCode // where !string.IsNullOrEmpty(mi.MiRmk) && mi.MiRmk.Contains(@"Without VAT") // select new // { // itemTotalPrice = oi.ItemTotalPrice // }; string strSqlWhere = ""; DynamicParameters dynamicParams = new DynamicParameters(); strSqlWhere = "CheckCode=@CheckCode AND BusDate=@BusDate"; dynamicParams.Add("CheckCode", strChkOrder); dynamicParams.Add("BusDate", checkBusDate); var lstOI = new SQLiteDbHelper().QueryMultiByWhere <TaOrderItemInfo>("Ta_OrderItem", strSqlWhere, dynamicParams); var lstVAT = from oi in lstOI join mi in CommonData.TaMenuItem on oi.ItemCode equals mi.MiDishCode where !string.IsNullOrEmpty(mi.MiRmk) && mi.MiRmk.Contains(@"Without VAT") select new { itemTotalPrice = oi.ItemTotalPrice }; decimal dTotal = 0; decimal dVatTmp = 0; decimal dVat = 0; if (lstVAT.Any()) { dTotal = lstVAT.ToList().Sum(vat => Convert.ToDecimal(vat.itemTotalPrice)); //交税 dVatTmp = (Convert.ToDecimal(CommonData.GenSet.FirstOrDefault().VATPer) / 100) * dTotal; dVat = Math.Round(dVatTmp, 2, MidpointRounding.AwayFromZero); } wbPrtTemplataTa.VatA = dVat.ToString(); //税前 wbPrtTemplataTa.Net1 = dTotal.ToString(); //总价 wbPrtTemplataTa.Gross1 = (dTotal - dVat).ToString(); wbPrtTemplataTa.Rate2 = "0.00%"; wbPrtTemplataTa.Net2 = (Convert.ToDecimal(sSubTotal) - dTotal).ToString(); wbPrtTemplataTa.VatB = "0.00"; wbPrtTemplataTa.Gross2 = (Convert.ToDecimal(sSubTotal) - dTotal).ToString(); } else { wbPrtTemplataTa.Rate1 = "0.00%"; wbPrtTemplataTa.Net1 = "0.00"; wbPrtTemplataTa.VatA = "0.00"; wbPrtTemplataTa.Gross1 = "0.00"; wbPrtTemplataTa.Rate2 = "0.00%"; wbPrtTemplataTa.Net2 = "0.00"; wbPrtTemplataTa.VatB = "0.00"; wbPrtTemplataTa.Gross2 = "0.00"; } #endregion return(wbPrtTemplataTa); }
//public static void SaveOrderItem(string strCheckId, string strBusDate, List<TaOrderItemInfo> lstOi) //{ // new SystemData().GetTaOrderItem(); // var lstDelOi = CommonData.TaOrderItem.Where(s => s.CheckCode.Equals(strCheckId) && s.BusDate.Equals(strBusDate)); // //删除原始数据 // foreach (var taOrderItemInfo in lstDelOi) // { // _control.DeleteEntity(taOrderItemInfo); // } // foreach (var taOrderItemInfo in lstOi) // { // //TaOrderItemInfo taOi = CommonData.TaOrderItem.FirstOrDefault(s => s.ID == taOrderItemInfo.ID); // //if (taOi != null) // //{ // // _control.UpdateEntity(taOrderItemInfo); // //} // //else // //{ // // _control.AddEntity(taOrderItemInfo); // //} // _control.AddEntity(taOrderItemInfo); // } //} #endregion //public static void SaveOrderItemAndDeleteOld(string strCheckId, string strBusDate, List<TaOrderItemInfo> lstOi) //{ // string strSql = ""; // strSql = "DELETE FROM Ta_OrderItem WHERE BusDate = '" + strBusDate + "' AND CheckCode = '" + strCheckId + "'"; // _control.ExecuteSql(strSql); // foreach (var taOrderItemInfo in lstOi) // { // _control.AddEntity(taOrderItemInfo); // } //} #region 保存CheckOrder public static void SaveCheckOrder(TaCheckOrderInfo taCheckOrderInfo, bool isRefreshData) { if (string.IsNullOrEmpty(taCheckOrderInfo.CheckCode) && string.IsNullOrEmpty(taCheckOrderInfo.BusDate)) { _control.AddEntity(taCheckOrderInfo); } else { string strSqlWhere = ""; DynamicParameters dynamicParams = new DynamicParameters(); //new SystemData().GetTaCheckOrderByCheckCodeAndBusDate(taCheckOrderInfo.CheckCode, taCheckOrderInfo.BusDate); //TaCheckOrderInfo taCheck = CommonData.TaCheckOrderByCheckCodeAndBusDate; strSqlWhere = "CheckCode=@CheckCode AND BusDate=@BusDate"; dynamicParams.Add("CheckCode", taCheckOrderInfo.CheckCode); dynamicParams.Add("BusDate", taCheckOrderInfo.BusDate); var taCheck = new SQLiteDbHelper().QueryFirstByWhere <TaCheckOrderInfo>("Ta_CheckOrder", strSqlWhere, dynamicParams); //new SystemData().GetTaCheckOrder(); //TaCheckOrderInfo taCheck = CommonData.TaCheckOrder.FirstOrDefault(s => // s.CheckCode.Equals(taCheckOrderInfo.CheckCode) && s.BusDate.Equals(taCheckOrderInfo.BusDate)); string strSql = ""; if (taCheck != null) { //_control.UpdateEntity(taCheckOrderInfo); //strSql = "UPDATE Ta_CheckOrder SET "; //strSql += "CheckCode='" + taCheckOrderInfo.CheckCode + "', "; //strSql += "PayOrderType='" + taCheckOrderInfo.PayOrderType + "', "; //strSql += "PayDelivery='" + taCheckOrderInfo.PayDelivery + "', "; //strSql += "PayPerDiscount='" + taCheckOrderInfo.PayPerDiscount + "', "; //strSql += "PayDiscount='" + taCheckOrderInfo.PayDiscount + "', "; //strSql += "PayPerSurcharge='" + taCheckOrderInfo.PayPerSurcharge + "', "; //strSql += "PaySurcharge='" + taCheckOrderInfo.PaySurcharge + "', "; //strSql += "MenuAmount='" + taCheckOrderInfo.MenuAmount + "', "; //strSql += "TotalAmount='" + taCheckOrderInfo.TotalAmount + "', "; //strSql += "Paid='" + taCheckOrderInfo.Paid + "', "; //strSql += "IsPaid='" + taCheckOrderInfo.IsPaid + "', "; //strSql += "CustomerID='" + taCheckOrderInfo.CustomerID + "', "; //strSql += "CustomerNote='" + taCheckOrderInfo.CustomerNote + "', "; //strSql += "DriverID='" + taCheckOrderInfo.DriverID + "', "; //strSql += "StaffID='" + taCheckOrderInfo.StaffID + "', "; //strSql += "PayTime='" + taCheckOrderInfo.PayTime + "', "; //strSql += "PayType1='" + taCheckOrderInfo.PayType1 + "', "; //strSql += "PayTypePay1='" + taCheckOrderInfo.PayTypePay1 + "', "; //strSql += "PayType2='" + taCheckOrderInfo.PayType2 + "', "; //strSql += "PayTypePay2='" + taCheckOrderInfo.PayTypePay2 + "', "; //strSql += "PayType3='" + taCheckOrderInfo.PayType3 + "', "; //strSql += "PayTypePay3='" + taCheckOrderInfo.PayTypePay3 + "', "; //strSql += "PayType4='" + taCheckOrderInfo.PayType4 + "', "; //strSql += "PayTypePay4='" + taCheckOrderInfo.PayTypePay4 + "', "; //strSql += "PayType5='" + taCheckOrderInfo.PayType5 + "', "; //strSql += "PayTypePay5='" + taCheckOrderInfo.PayTypePay5 + "', "; //strSql += "IsCancel='" + taCheckOrderInfo.IsCancel + "', "; //strSql += "IsSave='" + taCheckOrderInfo.IsSave + "', "; //strSql += "BusDate='" + taCheckOrderInfo.BusDate + "', "; //strSql += "RefNum='" + taCheckOrderInfo.RefNum + "', "; //strSql += "DeliveryFee='" + taCheckOrderInfo.DeliveryFee + "'"; //strSql += " WHERE ID = " + taCheck.ID; taCheckOrderInfo.ID = taCheck.ID; strSqlWhere = "ID=@ID"; new SQLiteDbHelper().Update <TaCheckOrderInfo>(@"Ta_CheckOrder", strSqlWhere, taCheckOrderInfo); } else { //_control.AddEntity(taCheckOrderInfo); //strSql = "INSERT INTO Ta_CheckOrder (CheckCode, PayOrderType, PayDelivery, PayPerDiscount, PayDiscount, PayPerSurcharge, PaySurcharge, " + // "MenuAmount, TotalAmount, Paid, IsPaid, CustomerID, CustomerNote, DriverID, StaffID, PayTime, PayType1, PayTypePay1, PayType2, PayTypePay2, " + // "PayType3, PayTypePay3, PayType4, PayTypePay4, PayType5, PayTypePay5, IsCancel, IsSave, BusDate, RefNum, DeliveryFee) VALUES ("; //strSql += "'" + taCheckOrderInfo.CheckCode + "', "; //strSql += "'" + taCheckOrderInfo.PayOrderType + "', "; //strSql += "'" + taCheckOrderInfo.PayDelivery + "', "; //strSql += "'" + taCheckOrderInfo.PayPerDiscount + "', "; //strSql += "'" + taCheckOrderInfo.PayDiscount + "', "; //strSql += "'" + taCheckOrderInfo.PayPerSurcharge + "', "; //strSql += "'" + taCheckOrderInfo.PaySurcharge + "', "; //strSql += "'" + taCheckOrderInfo.MenuAmount + "', "; //strSql += "'" + taCheckOrderInfo.TotalAmount + "', "; //strSql += "'" + taCheckOrderInfo.Paid + "', "; //strSql += "'" + taCheckOrderInfo.IsPaid + "', "; //strSql += "'" + taCheckOrderInfo.CustomerID + "', "; //strSql += "'" + taCheckOrderInfo.CustomerNote + "', "; //strSql += "'" + taCheckOrderInfo.DriverID + "', "; //strSql += "'" + taCheckOrderInfo.StaffID + "', "; //strSql += "'" + taCheckOrderInfo.PayTime + "', "; //strSql += "'" + taCheckOrderInfo.PayType1 + "', "; //strSql += "'" + taCheckOrderInfo.PayTypePay1 + "', "; //strSql += "'" + taCheckOrderInfo.PayType2 + "', "; //strSql += "'" + taCheckOrderInfo.PayTypePay2 + "', "; //strSql += "'" + taCheckOrderInfo.PayType3 + "', "; //strSql += "'" + taCheckOrderInfo.PayTypePay3 + "', "; //strSql += "'" + taCheckOrderInfo.PayType4 + "', "; //strSql += "'" + taCheckOrderInfo.PayTypePay4 + "', "; //strSql += "'" + taCheckOrderInfo.PayType5 + "', "; //strSql += "'" + taCheckOrderInfo.PayTypePay5 + "', "; //strSql += "'" + taCheckOrderInfo.IsCancel + "', "; //strSql += "'" + taCheckOrderInfo.IsSave + "', "; //strSql += "'" + taCheckOrderInfo.BusDate + "', "; //strSql += "'" + taCheckOrderInfo.RefNum + "', "; //strSql += "'" + taCheckOrderInfo.DeliveryFee + "'"; //strSql += ")"; strSqlWhere = "INSERT INTO Ta_CheckOrder (CheckCode, PayOrderType, PayDelivery, PayPerDiscount, PayDiscount, PayPerSurcharge, PaySurcharge, MenuAmount, TotalAmount, Paid, " + "IsPaid, CustomerID, CustomerNote, DriverID, StaffID, PayTime, PayType1, PayTypePay1, PayType2, PayTypePay2, PayType3, PayTypePay3, PayType4, PayTypePay4, " + "PayType5, PayTypePay5, IsCancel, IsSave, BusDate, RefNum, DeliveryFee) VALUES (@CheckCode, @PayOrderType, @PayDelivery, @PayPerDiscount, @PayDiscount, " + "@PayPerSurcharge, @PaySurcharge, @MenuAmount, @TotalAmount, @Paid, @IsPaid, @CustomerID, @CustomerNote, @DriverID, @StaffID, @PayTime, @PayType1, " + "@PayTypePay1, @PayType2, @PayTypePay2, @PayType3, @PayTypePay3, @PayType4, @PayTypePay4, @PayType5, @PayTypePay5, @IsCancel, @IsSave, @BusDate, @RefNum, @DeliveryFee)"; bool isSucess = new SQLiteDbHelper().Insert(strSqlWhere, taCheckOrderInfo); } //_control.ExecuteSql(strSql); if (isRefreshData) { CommonDAL.RefreshSomeInfo("1", "", ""); } } //new SystemData().GetTaCheckOrder(); }
private void btnPrtReceipt_Click(object sender, EventArgs e) { #region 原打印方式 //new SystemData().GetTaOrderItem(); //var lstOI = CommonData.TaOrderItem.Where(s => s.CheckCode.Equals(strChkOrder) && s.BusDate.Equals(deDay.Text)).ToList(); //PrtTemplataTa prtTemplataTa = new PrtTemplataTa(); //prtTemplataTa.RestaurantName = PrtCommon.GetRestName(); //prtTemplataTa.Addr = PrtCommon.GetRestAddr(); //prtTemplataTa.Telephone = PrtCommon.GetRestTel(); //prtTemplataTa.VatNo = PrtCommon.GetRestVATNo(); //prtTemplataTa.OrderTime = PrtCommon.GetPrtTime(); //prtTemplataTa.OrderDate = PrtCommon.GetPrtDateTime(); //prtTemplataTa.OrderNo = strChkOrder; //prtTemplataTa.PayType = GetPayType(strChkOrder); //prtTemplataTa.TotalAmount = sTotalAmount; //prtTemplataTa.SubTotal = sSubTotal; //prtTemplataTa.StaffName = sStaff; //prtTemplataTa.ItemCount = sItemCount >= 1 ? sItemCount.ToString() : "0"; //prtTemplataTa.Discount = sDiscount + sDiscountPer; //#region VAT计算 //if (CommonData.GenSet.Any()) //{ // prtTemplataTa.Rete1 = CommonData.GenSet.FirstOrDefault().VATPer + @"%"; // var lstVAT = from oi in CommonData.TaOrderItem.Where(s => s.CheckCode.Equals(strChkOrder) && s.BusDate.Equals(deDay.Text)) // join mi in CommonData.TaMenuItem on oi.ItemCode equals mi.MiDishCode // where !string.IsNullOrEmpty(mi.MiRmk) && mi.MiRmk.Contains(@"Without VAT") // select new // { // itemTotalPrice = oi.ItemTotalPrice // }; // decimal dTotal = 0; // decimal dVatTmp = 0; // decimal dVat = 0; // if (lstVAT.Any()) // { // dTotal = lstVAT.ToList().Sum(vat => Convert.ToDecimal(vat.itemTotalPrice)); // //交税 // dVatTmp = (Convert.ToDecimal(CommonData.GenSet.FirstOrDefault().VATPer) / 100) * dTotal; // dVat = Math.Round(dVatTmp, 2, MidpointRounding.AwayFromZero); // } // prtTemplataTa.VatA = dVat.ToString(); // //税前 // prtTemplataTa.Net1 = dTotal.ToString(); // //总价 // prtTemplataTa.Gross1 = (dTotal - dVat).ToString(); // prtTemplataTa.Rate2 = "0.00%"; // prtTemplataTa.Net2 = (Convert.ToDecimal(sSubTotal) - dTotal).ToString(); // prtTemplataTa.VatB = "0.00"; // prtTemplataTa.Gross2 = (Convert.ToDecimal(sSubTotal) - dTotal).ToString(); //} //else //{ // prtTemplataTa.Rete1 = "0.00%"; // prtTemplataTa.Net1 = "0.00"; // prtTemplataTa.VatA = "0.00"; // prtTemplataTa.Gross1 = "0.00"; // prtTemplataTa.Rate2 = "0.00%"; // prtTemplataTa.Net2 = "0.00"; // prtTemplataTa.VatB = "0.00"; // prtTemplataTa.Gross2 = "0.00"; //} //#endregion //PrtTemplate.PrtTa(prtTemplataTa, lstOI, PrtStatic.PRT_TEMPLATE_TA_RECEIPT_TYPE); #endregion Stopwatch sw = new Stopwatch(); sw.Start(); string strSqlWhere = ""; DynamicParameters dynamicParams = new DynamicParameters(); strSqlWhere = "CheckCode=@CheckCode AND BusDate=@BusDate"; dynamicParams.Add("CheckCode", strChkOrder); dynamicParams.Add("BusDate", checkBusDate); var lstOI = new SQLiteDbHelper().QueryMultiByWhere <TaOrderItemInfo>("Ta_OrderItem", strSqlWhere, dynamicParams); //new SystemData().GetTaOrderItem(); //var lstOI = CommonData.TaOrderItem.Where(s => s.CheckCode.Equals(strChkOrder) && s.BusDate.Equals(checkBusDate)).ToList(); WbPrtTemplataTa wbPrtTemplataTa = new WbPrtTemplataTa(); wbPrtTemplataTa = GetAllPrtInfo(); //WbPrtPrint.PrintHtml( WbPrtStatic.PRT_CLASS_RECEIPT, lstOI, wbPrtTemplataTa, sOrderType); DelegatePrtHtml handler = DelegateMy.PrtHtml; IAsyncResult result = handler.BeginInvoke(WbPrtStatic.PRT_CLASS_RECEIPT, lstOI, wbPrtTemplataTa, sOrderType, null, null); sw.Stop(); TimeSpan ts = sw.Elapsed; Console.WriteLine(@"#btnPrtReceipt_Click# Time:{0}", ts.TotalMilliseconds); }
private void RefreshPrtInfo(string sCheckOrder, string sBusDate) { System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); sw.Start(); if (string.IsNullOrEmpty(sCheckOrder)) { return; } if (doc == null) { doc = new HtmlWeb().Load(WbPrtStatic.PRT_TEMPLATE_FILE_PATH + @"so" + WbPrtStatic.PRT_TEMPLATE_FILE_NAME_SUFFIX); } string strSqlWhere = ""; DynamicParameters dynamicParams = new DynamicParameters(); strSqlWhere = "CheckCode=@CheckCode AND BusDate=@BusDate"; dynamicParams.Add("CheckCode", sCheckOrder); dynamicParams.Add("BusDate", sBusDate); var lstOI = new SQLiteDbHelper().QueryMultiByWhere <TaOrderItemInfo>("Ta_OrderItem", strSqlWhere, dynamicParams); //var lstOI = CommonData.TaOrderItem.Where(s => s.CheckCode.Equals(strChkOrder) && s.BusDate.Equals(checkBusDate)).ToList(); WbPrtTemplataTa wbPrtTemplataTa = new WbPrtTemplataTa(); wbPrtTemplataTa = CommonDAL.GetAllPrtInfo(intCusID <= 0 ? "" : intCusID.ToString(), sStaff, intStaffID.ToString(), sCheckOrder, sItemCount, sSubTotal, sTotalAmount, sTendered, sChange, sRefNo, sDeliveryFee, sDiscount, sSurcharge, sBusDate, sOrderType); string htmlText = doc.Text; if (string.IsNullOrEmpty(htmlText)) { webBrowser2.DocumentText = ""; } htmlText = WbPrtPrint.ReplaceHtmlPrtKeysShop(htmlText, wbPrtTemplataTa); htmlText = WbPrtPrint.GetOrderItemInfo(doc, htmlText, lstOI, false); webBrowser2.DocumentText = htmlText; sw.Stop(); TimeSpan ts = sw.Elapsed; Console.WriteLine(@"FrmAccountSummary RefreshPrtInfo Time:{0}", ts.TotalMilliseconds); LogHelper.Info(@"FrmAccountSummary RefreshPrtInfo Time:" + ts.TotalMilliseconds); //webBrowser2.Refresh(); }