private bool grdOutputsDocuments_Restore() { RFMCursorWait.Set(true); RFMCursorWait.LockWindowUpdate(FindForm().Handle); oOutputDocumentCur.ClearOne(); oOutputDocumentList.ClearError(); oOutputDocumentList.ClearFilters(); oOutputDocumentList.ID = null; oOutputDocumentList.IDList = null; grdOutputsDocuments.GetGridState(); grdOutputsDocumentsGoods.DataSource = null; oTrip.FillTableOutputsDocumentsInTrip(chkOutputsShowCarried.Checked); grdOutputsDocuments.IsLockRowChanged = true; grdOutputsDocuments.Restore(oTrip.TableOutputsDocumentsInTrip); tmrRestore.Enabled = true; RecalcSumOutputsDocuments(); ShowTotalInfo("OUTPUTSDOCUMENTS"); RFMCursorWait.LockWindowUpdate(IntPtr.Zero); RFMCursorWait.Set(false); return(oTrip.ErrorNumber == 0); }
private bool grdOutputsDocuments_Restore() { RFMCursorWait.Set(true); RFMCursorWait.LockWindowUpdate(FindForm().Handle); oOutputDocumentCur.ClearOne(); oOutputDocumentList.ClearError(); oOutputDocumentList.ClearFilters(); oOutputDocumentList.ID = null; oOutputDocumentList.IDList = null; // собираем условия // даты if (!dtrDates.dtpBegDate.IsEmpty) { oOutputDocumentList.FilterDateBeg = dtrDates.dtpBegDate.Value.Date; } if (!dtrDates.dtpEndDate.IsEmpty) { oOutputDocumentList.FilterDateEnd = dtrDates.dtpEndDate.Value.Date; } // доставка? if (optDeliveryNeed.Checked) { oOutputDocumentList.FilterDeliveryNeed = true; } if (optDeliveryNeedNot.Checked) { oOutputDocumentList.FilterDeliveryNeed = false; } // клиенты-поставщики if (txtPartnerSourceNameContext.Text.Trim().Length > 0) { Partner oPartnerSource = new Partner(); oPartnerSource.FilterNameContext = txtPartnerSourceNameContext.Text.Trim(); oPartnerSource.FillData(); oOutputDocumentList.FilterPartnersSourceList = ""; foreach (DataRow rcs in oPartnerSource.MainTable.Rows) { oOutputDocumentList.FilterPartnersSourceList += rcs["ID"].ToString() + ","; } } if (ucSelectRecordID_PartnersSource.IsSelectedExist) { oOutputDocumentList.FilterPartnersSourceList += ucSelectRecordID_PartnersSource.GetIdString(); } // клиенты-получатели if (txtPartnerTargetNameContext.Text.Trim().Length > 0) { Partner oPartnerTarget = new Partner(); oPartnerTarget.FilterNameContext = txtPartnerTargetNameContext.Text.Trim(); oPartnerTarget.FillData(); oOutputDocumentList.FilterPartnersTargetList = ""; foreach (DataRow rct in oPartnerTarget.MainTable.Rows) { oOutputDocumentList.FilterPartnersTargetList += rct["ID"].ToString() + ","; } } if (ucSelectRecordID_PartnersTarget.IsSelectedExist) { oOutputDocumentList.FilterPartnersTargetList += ucSelectRecordID_PartnersTarget.GetIdString(); } // владельцы if (ucSelectRecordID_Owners.IsSelectedExist) { oOutputDocumentList.FilterOwnersList = ucSelectRecordID_Owners.GetIdString(); } // рейс? if (optTripExists.Checked) { oOutputDocumentList.FilterTripExists = true; } if (optTripExistsNot.Checked) { oOutputDocumentList.FilterTripExists = false; } // задания на расход? if (optOutputExists.Checked) { oOutputDocumentList.FilterIsOutputExists = true; } if (optOutputExistsNot.Checked) { oOutputDocumentList.FilterIsOutputExists = false; } // выбранные товары if (sSelectedPackingsIDList.Length > 0) { oOutputDocumentList.FilterPackingsList = sSelectedPackingsIDList; } // подтверждение отгрузки if (optOutputsDocumentsIsConfirmedNot.Checked) { oOutputDocumentList.FilterIsConfirmed = false; } if (optOutputsDocumentsIsConfirmed.Checked) { oOutputDocumentList.FilterIsConfirmed = true; } // подтверждение доставки if (optOutputsDocumentsIsBroughtNot.Checked) { oOutputDocumentList.FilterIsBrought = false; } if (optOutputsDocumentsIsBrought.Checked) { oOutputDocumentList.FilterIsBrought = true; } // по рейсу string sTripsList = ""; if (txtTripAliasContext.Text.Trim().Length > 0) { Trip oTripFilter = new Trip(); oTripFilter.FilterAliasContext = txtTripAliasContext.Text.Trim(); oTripFilter.FillData(); if (oTripFilter.ErrorNumber == 0 && oTripFilter.MainTable != null) { foreach (DataRow tr in oTripFilter.MainTable.Rows) { sTripsList += tr["ID"].ToString() + ","; } } oOutputDocumentList.FilterTripsList = sTripsList; } if (numTripID.Value > 0) { if (oOutputDocumentList.FilterTripsList == null) { oOutputDocumentList.FilterTripsList = Convert.ToInt32(numTripID.Value).ToString(); } else { oOutputDocumentList.FilterTripsList += Convert.ToInt32(numTripID.Value).ToString(); } } // хосты if (nUserHostID.HasValue) { oOutputDocumentList.FilterHostsList = nUserHostID.ToString(); } else { if (ucSelectRecordID_Hosts.IsSelectedExist) { oOutputDocumentList.FilterHostsList = ucSelectRecordID_Hosts.GetIdString(); } } // // начальные условия if (oOutputDocument != null) { if (oOutputDocument.FilterOwnersList != null) { oOutputDocumentList.FilterOwnersList = oOutputDocument.FilterOwnersList; } if (oOutputDocument.FilterPartnersSourceList != null) { oOutputDocumentList.FilterPartnersSourceList = oOutputDocument.FilterPartnersSourceList; } if (oOutputDocument.FilterPartnersTargetList != null) { oOutputDocumentList.FilterPartnersTargetList = oOutputDocument.FilterPartnersTargetList; } if (oOutputDocument.FilterHostsList != null) { if (!nUserHostID.HasValue) { oOutputDocumentList.FilterHostsList = oOutputDocument.FilterHostsList; } else { if (!((string)("," + oOutputDocument.FilterHostsList + ",")).Contains("," + nUserHostID.ToString().Trim() + ",")) { oOutputDocumentList.FilterHostsList = "-1"; } } } } grdOutputsDocumentsGoods.DataSource = null; grdOutputsDocuments.GetGridState(); oOutputDocumentList.FillData(); grdOutputsDocuments.IsLockRowChanged = true; grdOutputsDocuments.Restore(oOutputDocumentList.MainTable); tmrRestore.Enabled = true; RFMCursorWait.LockWindowUpdate(IntPtr.Zero); RFMCursorWait.Set(false); return(oOutputDocumentList.ErrorNumber == 0); }