using POSV.Card; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace POSV.Stock { public partial class CostControlForm : BusinessForm { public CostControlForm() { InitializeComponent(); this.controlBox1.Text = "经营会计报表"; this.controlBox1.ShowApplicationVersion = false; } protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (this.DesignMode) return; this.Focus(); //可编辑cell颜色特殊标注 //生成变动成本 Color bgColor = ColorTranslator.FromHtml("193,255,192"); var panel = this.productChangeListTable.PrimaryGrid; panel.Columns["todayStock"].CellStyles.Default.Background.Color1 = bgColor; //辅助生成变动成本 var panel1 = this.productMoreChangeListTable.PrimaryGrid; panel1.Columns["todayStock"].CellStyles.Default.Background.Color1 = bgColor; //其他变动成本 var panel2 = this.productOtherChangeListTable.PrimaryGrid; panel2.Columns["money"].CellStyles.Default.Background.Color1 = bgColor; //固定费 var panel3 = this.productFixedChangeListTable.PrimaryGrid; panel3.Columns["money"].CellStyles.Default.Background.Color1 = bgColor; DateTime summData = DateTime.Now.Date; initData(summData); } public void initData(DateTime summData) { //第一步加载主单数据 this.busNoTextBox.Text = string.Format("K{0}{1}", DateTime.Now.ToString("yyyyMMddHHmmss"), Global.Instance.BusinessPlanLog.PosNo);//单据编号 this.storeNameTextBox.Text = Global.Instance.Worker.StoreInfo.Name;//门店名称 this.memoTextBox.Text = "";//备注 this.setManTextBox.Text = Global.Instance.BusinessPlanLog.WorkerNo;//制单人 this.setDateTextBox.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");//制单时间 this.dateInputPicker.Value = summData;//汇总日期 this.checkPeopleTextBox.Text = ""; this.checkDateTextBox.Text = ""; this.statusBox.Text = "新建"; var request = new StoreCostTicketSalesinfoRequest(); request.StoreId = Global.Instance.Authc.StoreId; request.Date = summData.ToString("yyyy-MM-dd"); var response = StockUtils.StoreCostTicketSalesinfo(request); if (response.Item1) { //营业额 amountTextBox.Text = string.Format("{0}", response.Item3.Data.Amount); //折扣金额 discountAmountTextBox.Text = string.Format("{0}", response.Item3.Data.DiscountAmount); //应收金额 receivableAmountTextBox.Text = string.Format("{0}", response.Item3.Data.ReceivableAmount); //单数 ticketCountTextBox.Text = string.Format("{0}", 0.00M); //客单价 peoplePriceTextBox.Text = string.Format("{0}", response.Item3.Data.PeoplePrice); //餐盒费 boxAmountTextBox.Text = string.Format("{0}", response.Item3.Data.BoxAmount); //员工餐 workerAmountTextBox.Text = string.Format("{0}", response.Item3.Data.WorkerAmount); //第六步加载分类汇总 typeListTable.PrimaryGrid.DataSource = response.Item3.Data.ProductTypeList; //第七步加载支付方式汇总 payTypeListTable.PrimaryGrid.DataSource = response.Item3.Data.PayTypeList; } //成本 totalCostTextBox.Text = string.Format("{0}", 0.00M); //纯利润 profitTextBox.Text = string.Format("{0}", 0.00M); var request1 = new StoreCostTicketTemplateInfoRequest(); request1.StoreId = Global.Instance.Authc.StoreId; var response1 = StockUtils.StoreCostTicketTemplateInfo(request1); if (response1.Item1) { //第二步加载生产变动成本模板数据 productChangeListTable.PrimaryGrid.DataSource = response1.Item3.Data.ProductChangeList; //第三步加载辅助生产变动成本模板数据 productMoreChangeListTable.PrimaryGrid.DataSource = response1.Item3.Data.MoreChangeList; //第四步加载其他变动费用成本模板数据 productOtherChangeListTable.PrimaryGrid.DataSource = response1.Item3.Data.OtherChangeList; //第五步加载固定费成本模板数据 productFixedChangeListTable.PrimaryGrid.DataSource = response1.Item3.Data.FixedChangeList; } } /// /// 保存单据 /// /// /// private void BtnSave(object sender, EventArgs e) { } /// /// 审核单据 /// /// /// private void BtnApply(object sender, EventArgs e) { } /// /// 关闭单据 /// /// /// private void BtnClose(object sender, EventArgs e) { //先关闭父窗体 if (this.Owner != null) { this.Owner.Close(); } //再关闭当前窗体 this.Close(); } /// /// 关闭单据 /// /// /// private void OnCloseTouchClick(object sender, EventArgs e) { //先关闭父窗体 if (this.Owner != null) { this.Owner.Close(); } //再关闭当前窗体 this.Close(); } /// /// 最大化 /// /// /// private void OnMinimizedClick(object sender, EventArgs e) { this.WindowState = FormWindowState.Minimized; } private void OnValueChange(object sender, EventArgs e) { DateTime summData = this.dateInputPicker.Value; initData(summData); } public delegate void EventHandler(object sender); public event EventHandler OnTicktQuery; } }