/// <summary> /// 系统初始化 /// </summary> private void Init() { #region 查询返修信息 DateTime dtBegin, dtEnd; ServerTime.GetMonthlyBalance(ServerTime.Time, out dtBegin, out dtEnd); dateTimePickerET.Value = dtBegin.AddDays(1).Date; RefreshDataGridViewOfRepairInfo(); #endregion string[] productType = null; if (!m_productInfoServer.GetAllProductType(out productType, out error)) { MessageDialog.ShowErrorMessage(error); return; } List <string> lstProductType = productType.ToList(); lstProductType.RemoveAll(p => p.Contains(" FX")); cmbOldCVTType.Items.Clear(); cmbNewCVTType.Items.Clear(); cmbOldCVTType.Items.AddRange(lstProductType.ToArray()); cmbNewCVTType.Items.AddRange(lstProductType.ToArray()); cmbOldCVTType.SelectedIndex = 0; cmbNewCVTType.SelectedIndex = 0; }
private void btnOK_Click(object sender, EventArgs e) { //if (ServerTime.Time.Day >= 25 && dtpBeginDate.Value.Month < ServerTime.Time.Month) //{ // MessageDialog.ShowPromptMessage("每月25号之后不允许对上个月的考勤再做统计!"); // return; //} if (MessageBox.Show("节假日、异常登记等所有信息是否都已经处理完成?", "消息", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { DataTable dtResult = m_dayBookServer.GetDayBookViewByDate(dtpBeginDate.Value.ToString(), dtpEndDate.Value.ToString()); try { for (int j = 0; j < dtResult.Rows.Count; j++) //循环在职需要考勤的员工 { string workID = dtResult.Rows[j]["员工编号"].ToString(); HR_AttendanceSetting attendanceSet = m_attendanceSchemeServer.GetAttendanceSettingByWorkID(workID); string[] schemeCode = attendanceSet.SchemeCode.Split(' '); string mode = m_attendanceSchemeServer.GetAttendanceSchemeByCode(schemeCode[0]).AttendanceMode; DateTime starTime, endTime; starTime = dtpBeginDate.Value; endTime = dtpEndDate.Value; if (mode.Contains("非自然")) { ServerTime.GetMonthlyBalance(dtpBeginDate.Value, out starTime, out endTime); endTime = endTime.AddDays(-1); } if (!m_attendanceServer.AddAttendanceSummary(workID, starTime, endTime, out m_error)) { MessageDialog.ShowPromptMessage(m_error); return; } } if (!m_attendanceServer.AddAttendanceSummaryByAllowOverTime(out m_error)) { MessageDialog.ShowPromptMessage(m_error); return; } MessageDialog.ShowPromptMessage("人员考勤统计已经完成"); } catch (Exception) { throw; } } else { return; } }
public UserControlAttendanceDaybook(PlatformManagement.FunctionTreeNodeInfo nodeInfo) { InitializeComponent(); m_authorityFlag = nodeInfo.Authority; DateTime dtStart, dtEnd; ServerTime.GetMonthlyBalance(ServerTime.Time, out dtStart, out dtEnd); dtpSelectStar.Value = dtStart; dtpSelectEnd.Value = dtEnd.AddDays(-1); RefreshDataGridView(); }
public UserControlTimeException(PlatformManagement.FunctionTreeNodeInfo nodeInfo) { InitializeComponent(); m_authorityFlag = nodeInfo.Authority; cmbRealExceptionType.DataSource = (from a in m_attendanceMachineServer.GetExceptionType() where a.IsBusiness == false && a.TypeName != CE_HR_AttendanceExceptionType.正常.ToString() && a.TypeName != CE_HR_AttendanceExceptionType.集体异常.ToString() && a.TypeName != CE_HR_AttendanceExceptionType.节假.ToString() select a.TypeName).ToList(); DateTime dtBegin, dtEnd; ServerTime.GetMonthlyBalance(ServerTime.Time, out dtBegin, out dtEnd); dtpBeginDate.Value = dtBegin; dtpEndDate.Value = dtEnd; RefreshDataGridView(); }
/// <summary> /// 变更金额_入库明细 /// </summary> /// <param name="dataContxt">数据上下文</param> /// <param name="detailInfo">结算单明细</param> void ChangePrice_S_InDepotDetailBill(DepotManagementDataContext dataContxt, View_Business_Settlement_ProcurementStatementDetail detailInfo) { DateTime dtStart = new DateTime(); DateTime dtEnd = new DateTime(); Business_Settlement_ProcurementStatement statement = GetSingleBillInfo(detailInfo.单据号); //获得当前日期的月结起始日期与结束日期 ServerTime.GetMonthlyBalance(ServerTime.Time, out dtStart, out dtEnd); var varInDepotBill = from b in dataContxt.S_InDepotDetailBill where b.GoodsID == detailInfo.物品ID && b.InDepotBillID == detailInfo.入库单号 && b.BatchNo == detailInfo.批次号 select b; if (varInDepotBill.Count() == 1) { S_InDepotDetailBill lnqInDepotBill = varInDepotBill.Single(); var varData1 = from a in dataContxt.BASE_Storage where a.StorageID == lnqInDepotBill.StorageID select a; if (varData1.Count() == 1) { BASE_Storage storageInfo = varData1.Single(); if (!storageInfo.FinancialAccountingFlag) { throw new Exception("单据号【" + lnqInDepotBill.InDepotBillID + "】的入库库房不在财务核算范围之内"); } } else { throw new Exception("单据号【" + lnqInDepotBill.InDepotBillID + "】的入库库房不存在或者重复"); } if (statement.BillType == CE_ProcurementStatementBillTypeEnum.委托加工物资.ToString()) { lnqInDepotBill.InvoiceUnitPrice = detailInfo.发票单价 + (decimal)detailInfo.单件委托材料; lnqInDepotBill.InvoicePrice = Math.Round((decimal)lnqInDepotBill.InvoiceUnitPrice * (decimal)lnqInDepotBill.InDepotCount, 2); } else { lnqInDepotBill.InvoiceUnitPrice = detailInfo.发票单价; lnqInDepotBill.InvoicePrice = detailInfo.发票金额; } if (lnqInDepotBill.FactPrice != detailInfo.发票金额) { //当查询的记录不在当月的结算日期范围内,插入红冲单据与对冲单据 if (lnqInDepotBill.BillTime < dtStart || lnqInDepotBill.BillTime > dtEnd) { var varDetail = from d in dataContxt.S_InDepotDetailBill where d.GoodsID == detailInfo.物品ID && d.InDepotBillID.Contains(detailInfo.入库单号) && d.BatchNo == detailInfo.批次号 && d.BillTime >= dtStart && d.BillTime <= dtEnd select d; //判断是否已经在当前结算日期范围内插入了红冲与对冲数据 if (varDetail.Count() != 0) { foreach (var item in varDetail) { //针对已经插入的对冲数据进行修改 if (item.InDepotBillID.Contains("(对冲单据)")) { if (statement.BillType == CE_ProcurementStatementBillTypeEnum.委托加工物资.ToString()) { item.FactUnitPrice = detailInfo.发票单价 + (decimal)detailInfo.单件委托材料; item.FactPrice = Math.Round((decimal)item.FactUnitPrice * (decimal)item.InDepotCount, 2); } else { item.FactUnitPrice = detailInfo.发票单价; item.FactPrice = detailInfo.发票金额; } } } }//对没有插入的红冲与对冲的记录进行插入 else { //插一条原始的负记录(红冲单据) S_InDepotDetailBill lnqOldInDepotBill = new S_InDepotDetailBill(); lnqOldInDepotBill.ID = Guid.NewGuid(); lnqOldInDepotBill.InDepotBillID = lnqInDepotBill.InDepotBillID + "(红冲单据)"; lnqOldInDepotBill.BatchNo = lnqInDepotBill.BatchNo; lnqOldInDepotBill.BillTime = ServerTime.Time; lnqOldInDepotBill.Department = lnqInDepotBill.Department; lnqOldInDepotBill.FactUnitPrice = lnqInDepotBill.FactUnitPrice; lnqOldInDepotBill.FactPrice = -lnqInDepotBill.FactPrice; lnqOldInDepotBill.FillInPersonnel = lnqInDepotBill.FillInPersonnel; lnqOldInDepotBill.GoodsID = lnqInDepotBill.GoodsID; lnqOldInDepotBill.InDepotCount = -lnqInDepotBill.InDepotCount; lnqOldInDepotBill.Price = -lnqInDepotBill.Price; lnqOldInDepotBill.OperationType = (int)GlobalObject.CE_SubsidiaryOperationType.财务红冲; lnqOldInDepotBill.Provider = lnqInDepotBill.Provider; lnqOldInDepotBill.Remark = lnqInDepotBill.Remark; lnqOldInDepotBill.StorageID = lnqInDepotBill.StorageID; lnqOldInDepotBill.UnitPrice = lnqInDepotBill.UnitPrice; lnqOldInDepotBill.FillInDate = lnqInDepotBill.FillInDate; lnqOldInDepotBill.AffrimPersonnel = lnqInDepotBill.AffrimPersonnel; IFinancialDetailManagement serverDetail = ServerModule.ServerModuleFactory.GetServerModule <IFinancialDetailManagement>(); serverDetail.ProcessInDepotDetail(dataContxt, lnqOldInDepotBill, null); //插一条新的正记录(对冲单据) S_InDepotDetailBill lnqNewInDepotBill = new S_InDepotDetailBill(); lnqNewInDepotBill.ID = Guid.NewGuid(); lnqNewInDepotBill.InDepotBillID = lnqInDepotBill.InDepotBillID + "(对冲单据)"; lnqNewInDepotBill.BatchNo = lnqInDepotBill.BatchNo; lnqNewInDepotBill.BillTime = ServerTime.Time; lnqNewInDepotBill.Department = lnqInDepotBill.Department; lnqNewInDepotBill.InDepotCount = lnqInDepotBill.InDepotCount; if (statement.BillType == CE_ProcurementStatementBillTypeEnum.委托加工物资.ToString()) { lnqNewInDepotBill.FactUnitPrice = detailInfo.发票单价 + (decimal)detailInfo.单件委托材料; lnqNewInDepotBill.FactPrice = Math.Round((decimal)lnqNewInDepotBill.FactUnitPrice * (decimal)lnqNewInDepotBill.InDepotCount, 2); } else { lnqNewInDepotBill.FactUnitPrice = detailInfo.发票单价; lnqNewInDepotBill.FactPrice = detailInfo.发票金额; } lnqNewInDepotBill.FillInPersonnel = lnqInDepotBill.FillInPersonnel; lnqNewInDepotBill.GoodsID = lnqInDepotBill.GoodsID; lnqNewInDepotBill.Price = lnqInDepotBill.Price; lnqNewInDepotBill.OperationType = (int)GlobalObject.CE_SubsidiaryOperationType.财务对冲; lnqNewInDepotBill.Provider = lnqInDepotBill.Provider; lnqNewInDepotBill.Remark = lnqInDepotBill.Remark; lnqNewInDepotBill.StorageID = lnqInDepotBill.StorageID; lnqNewInDepotBill.UnitPrice = lnqInDepotBill.UnitPrice; lnqNewInDepotBill.FillInDate = lnqInDepotBill.FillInDate; lnqNewInDepotBill.AffrimPersonnel = lnqInDepotBill.AffrimPersonnel; serverDetail.ProcessInDepotDetail(dataContxt, lnqNewInDepotBill, null); } } else { if (statement.BillType == CE_ProcurementStatementBillTypeEnum.委托加工物资.ToString()) { lnqInDepotBill.FactUnitPrice = detailInfo.发票单价 + (decimal)detailInfo.单件委托材料; lnqInDepotBill.FactPrice = Math.Round((decimal)lnqInDepotBill.InvoiceUnitPrice * (decimal)lnqInDepotBill.InDepotCount, 2); } else { lnqInDepotBill.FactUnitPrice = detailInfo.发票单价; lnqInDepotBill.FactPrice = detailInfo.发票金额; } } } dataContxt.SubmitChanges(); } }