// передача в файл формы РСВ (2017) GetFormat(isForm2020) { if ( !GetCommonCnfInt("Format","6ndfl") ) return 0; // если в настройках задана печать в PDF, но модуль печати в PDF не установлен переключаем на печать в Excel if ( !isForm2020 ) return IsPDF417_Exist(false,"1151111_5.01000_01.tif"); else return IsPDF417_Exist(false,"1151111_5.02000_02.tif"); } TrRSV2017toXML(AdrCTabl, bPrintPDF417) { var Tbl; if ( AdrCTabl ) Rsv2017ReportVersion = IsNewPFReportInterface(AdrCTabl, Tbl, Rsv2017ReportParams); else { Tbl = CreateObject("CurPrnTbl"); Rsv2017ReportVersion = IsNewPFReportInterfaceT(Tbl,Rsv2017ReportParams); } // Из настроек берем номер пачки string strDateEndP = GetParametrTable(Tbl,"DateEnd"); var DateEndP = CreateObject("KDate"); DateEndP.SetDate(strDateEndP); DateEndP.ImproveDay(); DateEndP.SetDateII(DateEndP.CountDay(),DateEndP.GetAbs()); strDateEndP=DateEndP.GetStr(); bool isForm2020 = DateEndP.GetYear() >= 2020; string strNumPack = DefineNextNumPack6NDFL(strDateEndP); string pathOut; if (Rsv2017ReportVersion == 0 ) { if ( !bPrintPDF417 || GetFormat(isForm2020) ) if ( Panel_ParamTran6NDFL(strNumPack,bPrintPDF417)==ESC ) return 0; var OptionsT = CreateObject("TransferOptions"); string Path = OptionsT.GetNameFileWin(); pathOut = TrimN(Path); } else { // CorrectDepartmentId(idOrg, Rsv2017ReportParams); // if ( Rsv2017ReportParams.PfPacketParams.StatusAsString=="Submitted" ) // UpdateOrgParams=0; pathOut= Rsv2017ReportParams.PfPacketParams.RootDirectory + "\\" + Rsv2017ReportParams.PfPacketParams.Directory; if ( bPrintPDF417!=2 ) { // и удалим XML int idx = 0; string path = pathOut + "\\"; while (idx < Rsv2017ReportParams.PackList.Count) { var pack = Rsv2017ReportParams.PackList.Item(idx); if (IsEmpty(pack.XmlFileName)) { idx++; continue; } DeleteFiles(path, pack.XmlFileName); Rsv2017ReportParams.PackList.RemoveAt(idx); } } } var mainMgr = CreateMainManagerRsv2017(Tbl); var ids = Tbl.VarL.GetManagersIds(); for (int i = 0; i < ids.Count(); i++) { if (ids.Item(i) == "") continue; var mgr = Tbl.VarL.GetManager(ids.Item(i)); if (!mgr.IsAnyDataExist() || !mgr.IsCommonDataExist()) continue; if (bPrintPDF417==2) { Print417_RSV2017(mgr,Rsv2017ReportVersion,bPrintPDF417,isForm2020); continue; } string file = mgr.GenerateFuf(pathOut, strNumPack)[0]; if (Rsv2017ReportVersion==0) continue; var pack = Rsv2017ReportParams.NewPack(); pack.XmlFileName = file; pack.PackNum = atoi(strNumPack); Rsv2017ReportParams.PackList.Add(pack); IncrementNumPack6NDFL(strNumPack); } if ( !bPrintPDF417 || GetFormat(isForm2020) ) SaveNumPack6NDFL(strDateEndP,strNumPack); return 0; } Print417_RSV2017(mgr,NewPFReportVersion,bPrintPDF417,isForm2020) { string tifTeplate; if ( !isForm2020 ) tifTeplate = "1151111_5.01000_01.tif"; else tifTeplate = "1151111_5.02000_02.tif"; // Выдавать сообщение, что шаблоны pdf не найдены, только в случае если в настройках печать pdf if ( ( GetCommonCnfInt("Format","6ndfl") && !IsPDF417_Exist(true,tifTeplate) ) || !GetFormat(isForm2020) ) return mgr.PrintReport(); string file = mgr.GenerateFuf(GetEmpty(), "")[0]; // печать формы с двумерным штрих-кодом bool keepfile=false; { keepfile=TAXDocPrint(file); int rc = 0; // Если у нас была только печать, то в случае неуспеха - сообщаем об этом, // а если печать шла из нового режима отчетности, // то ничего не надо сохранять if ( bPrintPDF417==2 ) { if ( !keepfile ) rc=2; if ( NewPFReportVersion ) keepfile=0; } // Если шла только печать (а не передача с печатью) // то в случае удачной печати спросим надо ли сохранить файл if ( !NewPFReportVersion && keepfile) { keepfile = false; } // в случае неудачи или отрицательного ответа - удаляем за собой и на выход if (!keepfile) { DeleteFile(file); return rc; } } } FillParamTran6NDFL() { var OptionsT = CreateObject("TransferOptions"); string Path = Rsv2017ReportParams.PfPacketParams.RootDirectory + "\\" + Rsv2017ReportParams.PfPacketParams.Directory + "\\"; OptionsT.SetNameFileWin(Path); }