Esempio n. 1
0
        /// <summary>
        /// 导入单据明细
        /// </summary>
        /// <param name="lstBillNo">单据号列表</param>
        /// <param name="billType">单据类型</param>
        /// <returns>返回Table</returns>
        public DataTable LeadInDetail(List <string> lstBillNo, CE_ProcurementStatementBillTypeEnum billType)
        {
            string error = "";
            DepotManagementDataContext ctx = CommentParameter.DepotDataContext;

            var varData = from a in ctx.Business_Settlement_ProcurementStatement_TempTable
                          select a;

            ctx.Business_Settlement_ProcurementStatement_TempTable.DeleteAllOnSubmit(varData);

            foreach (string item in lstBillNo)
            {
                Business_Settlement_ProcurementStatement_TempTable tempLnq = new Business_Settlement_ProcurementStatement_TempTable();
                tempLnq.BillNo = item;
                ctx.Business_Settlement_ProcurementStatement_TempTable.InsertOnSubmit(tempLnq);
            }

            ctx.SubmitChanges();

            DataTable result  = new DataTable();
            Hashtable hsTable = new Hashtable();

            hsTable.Add("@Flag", billType == CE_ProcurementStatementBillTypeEnum.零星采购加工 ? true : false);

            result = GlobalObject.DatabaseServer.QueryInfoPro("Business_Settlement_ReferemceDetail", hsTable, out error);
            return(result);
        }
Esempio n. 2
0
        private void cmbBillType_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (customDataGridView1.Columns.Count == 0)
            {
                return;
            }

            CE_ProcurementStatementBillTypeEnum billType =
                GlobalObject.GeneralFunction.StringConvertToEnum <CE_ProcurementStatementBillTypeEnum>(cmbBillType.Text);

            if (billType == CE_ProcurementStatementBillTypeEnum.零星采购加工)
            {
                //cmbInvoiceType.Enabled = true;
                cmbTaxRate.Enabled = true;
            }
            else
            {
                //cmbInvoiceType.Enabled = false;
                cmbTaxRate.Enabled = false;
            }

            if (billType == CE_ProcurementStatementBillTypeEnum.委托加工物资)
            {
                customDataGridView1.Columns["入库单价_不含税"].Visible = false;
                customDataGridView1.Columns["单件委托材料"].Visible   = true;
                customDataGridView1.Columns["单件加工费"].Visible    = true;
                customDataGridView1.Columns["委托加工材料"].Visible   = true;
                //customDataGridView1.Columns["税额"].Visible = false;
                //customDataGridView1.Columns["价税合计"].Visible = false;
            }
            else
            {
                customDataGridView1.Columns["入库单价_不含税"].Visible = true;
                customDataGridView1.Columns["单件委托材料"].Visible   = false;
                customDataGridView1.Columns["单件加工费"].Visible    = false;
                customDataGridView1.Columns["委托加工材料"].Visible   = false;
                //customDataGridView1.Columns["税额"].Visible = true;
                //customDataGridView1.Columns["价税合计"].Visible = true;
            }
        }
Esempio n. 3
0
        private bool customPanel1_PanelGetDataInfo(CE_FlowOperationType flowOperationType)
        {
            try
            {
                if (flowOperationType == CE_FlowOperationType.提交)
                {
                    if (!CheckData_Submit())
                    {
                        return(false);
                    }

                    if (GlobalObject.GeneralFunction.StringConvertToEnum <CE_CommonBillStatus>(lbBillStatus.Text) == CE_CommonBillStatus.等待审核)
                    {
                        CE_ProcurementStatementBillTypeEnum billType =
                            GlobalObject.GeneralFunction.StringConvertToEnum <CE_ProcurementStatementBillTypeEnum>(cmbBillType.Text);

                        foreach (DataGridViewRow dgvr in customDataGridView1.Rows)
                        {
                            if (billType != CE_ProcurementStatementBillTypeEnum.委托加工物资)
                            {
                                if (Convert.ToDecimal(dgvr.Cells["入库金额"].Value) != Convert.ToDecimal(dgvr.Cells["发票金额"].Value) &&
                                    dgvr.Cells["差异说明"].Value.ToString().Trim().Length == 0)
                                {
                                    MessageDialog.ShowPromptMessage("入库金额与发票金额不一致的记录的差异说明不能为空");
                                    return(false);
                                }
                            }
                            else
                            {
                                decimal dcTemp = Convert.ToDecimal(dgvr.Cells["入库数量"].Value) * Convert.ToDecimal(dgvr.Cells["单件委托材料"].Value);

                                if (Convert.ToDecimal(dgvr.Cells["入库金额"].Value) != (Convert.ToDecimal(dgvr.Cells["发票金额"].Value) + dcTemp) &&
                                    dgvr.Cells["差异说明"].Value.ToString().Trim().Length == 0)
                                {
                                    MessageDialog.ShowPromptMessage("入库金额与(发票金额 + 入库数量 * 单件委托材料) 不一致的记录的差异说明不能为空");
                                    return(false);
                                }
                            }
                        }
                    }
                }
                else if (flowOperationType == CE_FlowOperationType.暂存)
                {
                    if (!CheckData_Hold())
                    {
                        return(false);
                    }
                }

                m_lnqBillInfo = new Business_Settlement_ProcurementStatement();

                m_lnqBillInfo.BillNo              = txtBillNo.Text;
                m_lnqBillInfo.BillType            = cmbBillType.Text;
                m_lnqBillInfo.InvoiceType         = cmbInvoiceType.Text;
                m_lnqBillInfo.SettlementCompany   = txtSettlementCompany.Tag.ToString();
                m_lnqBillInfo.TaxRate             = Convert.ToDecimal(cmbTaxRate.Text);
                m_lnqBillInfo.AccoutingDocumentNo = txtAccoutingDocumentNo.Text;

                List <View_Business_Settlement_ProcurementStatementDetail> listTemp = new List <View_Business_Settlement_ProcurementStatementDetail>();

                foreach (DataGridViewRow dgvr in customDataGridView1.Rows)
                {
                    View_Business_Settlement_ProcurementStatementDetail detailTemp = new View_Business_Settlement_ProcurementStatementDetail();

                    detailTemp.差异说明   = dgvr.Cells["差异说明"].Value == null ? "" : dgvr.Cells["差异说明"].Value.ToString();
                    detailTemp.零件名称   = dgvr.Cells["零件名称"].Value == null ? "" : dgvr.Cells["零件名称"].Value.ToString();
                    detailTemp.物品ID   = Convert.ToInt32(dgvr.Cells["物品ID"].Value);
                    detailTemp.零件图号   = dgvr.Cells["零件图号"].Value == null ? "" : dgvr.Cells["零件图号"].Value.ToString();
                    detailTemp.规格     = dgvr.Cells["规格"].Value == null ? "" : dgvr.Cells["规格"].Value.ToString();
                    detailTemp.单据号    = txtBillNo.Text;
                    detailTemp.批次号    = dgvr.Cells["批次号"].Value == null ? "" : dgvr.Cells["批次号"].Value.ToString();
                    detailTemp.单件加工费  = (decimal?)dgvr.Cells["单件加工费"].Value;
                    detailTemp.单件委托材料 = (decimal?)dgvr.Cells["单件委托材料"].Value;
                    detailTemp.发票单价   = Convert.ToDecimal(dgvr.Cells["发票单价"].Value);
                    detailTemp.发票金额   = Convert.ToDecimal(dgvr.Cells["发票金额"].Value);
                    detailTemp.合同申请单号 = dgvr.Cells["执行合同号_申请单"].Value == null ? "" : dgvr.Cells["执行合同号_申请单"].Value.ToString();
                    detailTemp.价税合计   = (decimal?)dgvr.Cells["价税合计"].Value;
                    detailTemp.入库单号   = dgvr.Cells["入库单号"].Value == null ? "" : dgvr.Cells["入库单号"].Value.ToString();
                    detailTemp.入库单价   = (decimal)dgvr.Cells["入库单价_不含税"].Value;
                    detailTemp.入库金额   = (decimal)dgvr.Cells["入库金额"].Value;
                    detailTemp.入库数量   = (decimal)dgvr.Cells["入库数量"].Value;
                    detailTemp.税额     = (decimal)dgvr.Cells["税额"].Value;
                    detailTemp.委托加工材料 = (decimal)dgvr.Cells["委托加工材料"].Value;

                    listTemp.Add(detailTemp);
                }

                this.FlowInfo_BillNo = txtBillNo.Text;
                this.ResultInfo      = m_lnqBillInfo;

                this.ResultList = new List <object>();

                this.ResultList.Add(m_listInvoice);
                this.ResultList.Add(listTemp);
                this.ResultList.Add(flowOperationType);
                this.KeyWords = "【供应商】:" + m_lnqBillInfo.SettlementCompany;

                return(true);
            }
            catch (Exception ex)
            {
                MessageDialog.ShowPromptMessage(ex.Message);
                return(false);
            }
        }