//导入结算单据 void ImportDocument() { if (windowStatus == WindowStatus.View) { return; } if (txtcCustName.Tag == null)//客户 { MessageBoxEx.Show(string.Format("请选择{0}!", lblCustName.Text.Replace(":", ""))); txtcCustName.Focus(); return; } string paymentType = CommonCtrl.IsNullToString(cboOrderType.SelectedValue);//收付款类型 if (paymentType.Length == 0) { return; } if (orderType == DataSources.EnumOrderType.RECEIVABLE) { #region 应收 DataSources.EnumReceivableType enumType = (DataSources.EnumReceivableType)int.Parse(paymentType); if (enumType == DataSources.EnumReceivableType.RECEIVABLE) { cmsImport.Show(base.btnImport, 0, base.btnImport.Height); return; } else { //预收 frmReceivableByAdvances frm = new frmReceivableByAdvances(txtcCustName.Tag.ToString()); if (frm.ShowDialog() == DialogResult.OK) { BindDocument(frm.listRows, true); } } #endregion } else { #region 应付 StringBuilder sbWhere = new StringBuilder(); DataSources.EnumPaymentType enumType = (DataSources.EnumPaymentType)int.Parse(paymentType); if (enumType == DataSources.EnumPaymentType.PAYMENT) { frmPayment frm = new frmPayment(txtcCustName.Tag.ToString()); if (frm.ShowDialog() == DialogResult.OK) { BindDocument(frm.listRows, false); } } else { frmPaymentByAdvances frm = new frmPaymentByAdvances(txtcCustName.Tag.ToString()); if (frm.ShowDialog() == DialogResult.OK) { BindDocument(frm.listRows, true); } } #endregion } }
/// <summary> /// 导入预收 /// </summary> void ImportYuShou(TextChooser txtcCust, Label lblCust) { if (txtcCust.Tag == null) { MessageBoxEx.Show(string.Format("请选择{0}!", lblCust.Text.TrimEnd(':'))); txtcCust.Focus(); return; } //frmBalanceDocuments frmDocumentsYu = new frmBalanceDocuments(DataSources.EnumOrderType.RECEIVABLE, txtcCust.Tag.ToString(), ((int)DataSources.EnumReceivableType.ADVANCES).ToString()); frmReceivableByAdvances frmDocumentsYu = new frmReceivableByAdvances(txtcCust.Tag.ToString()); if (frmDocumentsYu.ShowDialog() == DialogResult.OK) { StringBuilder sbWhere = new StringBuilder(); sbWhere.AppendFormat("sale_order_id in ({0})", frmDocumentsYu.ids); sbWhere.AppendFormat(" and wait_money>0"); DataTable dt = DBHelper.GetTable("", "v_parts_sale_order_receivable", "*", sbWhere.ToString(), "", ""); foreach (DataRow dr in dt.Rows) { DataGridViewRow dgvr = dgvDocuments.Rows[dgvDocuments.Rows.Add()]; dgvr.Cells[colOrderName.Name].Value = "销售订单";//单据名称 dgvr.Cells[colOrderNum.Name].Value = dr["order_num"];//单据编号 dgvr.Cells[colOrderID.Name].Value = dr["sale_billing_id"];//单据ID //dgvr.Cells[colOrderDate.Name].Value = Common.UtcLongToLocalDateTime(dr["receivables_date"]);//单据日期 dgvr.Cells[colMoney.Name].Value = dr["advance_money"];//开单金额 dgvr.Cells[colSettledMoney.Name].Value = dr["money"];//已结算金额 dgvr.Cells[colWaitMoney.Name].Value = dr["wait_money"];//未结算金额 } } }
/// <summary> /// 导入预收 /// </summary> void ImportReceivableByAdvances() { frmReceivableByAdvances frm = new frmReceivableByAdvances(txtcCustName.Tag.ToString()); if (frm.ShowDialog() == DialogResult.OK) { BindDocument(frm.listRows, true); } }