//////////////////////////////////////////////////////////////////////////// // ( ) // ( - funcrw.s //////////////////////////////////////////////////////////////////////////// R_BZ_Script(mes,tip,ExtCod) // -!! // R_BZ(, , _) // - (CMN_SRC_REFS) { try { var ts = CreateObject("TempCommonSrc"); ts.TempCommonSrcInitial(CMN_SRC_COUNT_LS); SetCommonProp(CMN_SRC_COUNT_LS,GetCommonProp(CMN_SRC_REFS)); double rez=0.; poiskbzm(Extern_To_InternE(atof(ExtCod)),atoi(mes),rez,atoi(tip)); return rez; } catch(object err) // { SayError(err); // return 0.; } catch(...) // { SayUndefinedScriptError(); return 0.; } } GetDateVP(ExtCod,m,mv) { double Cod = Extern_To_InternE(ExtCod); var Dat = CreateObject("KDate"); Dat.SetDateD(GetDateFromFuncRWScript(m)); int mabs = Dat.GetAbs(); Dat.SetDateD(GetDateFromFuncRWScript(mv)); int mvabs = Dat.GetAbs(); var LS = CreateObject("LS"); LS.GetGlobalLS(); var MatrLS = LS.MatrLS(); var Prop = CreateObject("APropBE"); var SumElem = MatrLS.CollectSumm(Cod, mabs, mvabs, CL_EXACT|CL_M|CL_MV,Prop); return SumElem.Date.GetStr(); } CalcTableAfterCreate(__AdrTable) { var Tabl = CreateObject("CurPrnTbl"); Tabl.Initial(__AdrTable); Tabl.Fill_Bottom_Text_2(); // 17.02.2017 , ᤥ ᠬ "ਥ " ⠡ // Tabl.Rewrite(); return 0; } Correct_Address_Razn(&addrOEM, sz, what, how, tn, kchfld, date, param) // addrOEM - ( OEM ) // sz - // what - (. 2- ) // how - (. 3- ) // tn - , ( 0 - ) // kchfld - , // date - , // param - (1)/ (0), +2 - { int res=Correct_Address(addrOEM,sz,what,how); if (res && tn>0 && !razovnum && strlen(kchfld)>0 && ( (param&1)==0 || AmbaMessageBox(" ?","-௫",MB_YESNO|MB_ICONQUESTION,0)==IDYES) ) { int R_C = LSRead(tn,2); //2 - , if ( R_C==1 ) { var objDate=CreateObject("KDate"); objDate.SetDate(static_cast_to_string(date)); SetKchValue(kchfld, addrOEM, objDate); lswrite(ls,0); } } if (param&2) UpperString(addrOEM); return addrOEM; } CompareIndexWithKLADR(addrOEM) { if (Str_Cmp(static_cast_to_string(addrOEM)," "," ,.-0")==0) return " "; var kadres=CreateObject("Adres"); kadres.Initial(static_cast_to_string(addrOEM),0); int index=kadres.GetIndex(); int indexKLADR=GetIndex(addrOEM); if (index==indexKLADR) return " "; switch (indexKLADR) { case 0: return " "; case 1: return " 㪠, ࠢ筨"; case 2: return " ࠢ筨"; case 3: return "த ࠢ筨"; case 4: return "ᥫ 㭪 ࠢ筨"; case 5: return " ࠢ筨"; case 9: return "࠭ ⫨砥 ᨨ - ஫ "; } char buf[15]; sprintf(buf,indexKLADR); return buf; } Change_Index_Razn(addrOEM, indexStr, kchfld, date) // addrOEM - ( OEM ) // indexStr - , // kchfld - , // date - , { int index=atoi(static_cast_to_string(indexStr)); if (Str_Cmp(static_cast_to_string(addrOEM)," "," ,.-0")==0) return; if (!index) return addrOEM; var kadres=CreateObject("Adres"); kadres.Initial(static_cast_to_string(addrOEM),0); kadres.SetIndex(index); string param=kchfld; param+=",1,"; param+=date; return W_Face(param,kadres.GetAdres("_",""),255,0); } GetNameGroopUdForm425() { UnLoadScriptModule("forms\\CommonPartOfVacationForms"); LoadScriptModule("forms\\CommonPartOfVacationForms"); ZaprosNameGroupUd("425"); UnLoadScriptModule("forms\\CommonPartOfVacationForms"); } GetNameGroupUdForm(nameForm) { UnLoadScriptModule("forms\\CommonPartOfVacationForms"); LoadScriptModule("forms\\CommonPartOfVacationForms"); ZaprosNameGroupUd(nameForm); UnLoadScriptModule("forms\\CommonPartOfVacationForms"); } IsMedCategory(kat) { char s[256]; GetCommonCnf("MedCat","egisz",s,255); if (!Str_Cmp(s," "," ")) return 1; var FuncParam = CreateObject("ParamFuncRW"); FuncParam.IInitial(static_cast_to_string(s),",",CatCount()); int paramCount=FuncParam.Count(); for (int param=0; param0) { R_Face(name+", "+dateStart,s,255,0); int num=kch_num_sys(name); if (decodeID && num>=0) return GetKchValByIdFromRef(name,s,-1); return s; } else return ""; } IsLSAttestWholePeriod() { int len = 256; char ts[len], arg[len], str[len]; var m1 = CreateObject("KMonth"); var m2 = CreateObject("KMonth"); m1.SetDate(static_cast_to_string(Str_Date_0)); m2.SetDate(static_cast_to_string(Str_Date_1)); var mes_rb = CreateObject("KMonth"); var mes_uv = CreateObject("KMonth"); kch_from("data_rb",str); FreeSpaceString(str,3,""); mes_rb.SetDate(static_cast_to_string(str)); kch_from("data_uv",str); FreeSpaceString(str,3,""); mes_uv.SetDate(static_cast_to_string(str)); int ames_rb = mes_rb.GetAbs(); int ames_uv = mes_uv.GetAbs(); int mbeg = m1.GetAbs(), mend = m2.GetAbs(); int fatt = 1; //if ( !mes_uv.IsEqI(INVALID_MONTH_VALUE) ) if ( ames_uv < ames_rb ) fatt = 0; var mb = CreateObject("KMonth"); if ( !mes_rb.IsEqI(INVALID_MONTH_VALUE) ) if ( ames_rb > mbeg ) mbeg = ames_rb; if ( !mes_uv.IsEqI(INVALID_MONTH_VALUE) ) if ( ames_uv < mend ) mend = ames_uv; for ( int mes = mbeg; mes <= mend; mes++ ) { // mb.SetMonth(mes); sprintf(ts,"%04d%02d.%02d", mb.GetYear(), mb.GetMonth(), mb.CountDay()); // arg = "attest," + ts; //sprintf(arg,"attest,%s", ts); if ( 0 == atoi(R_Face(arg,str,14,0)) ) fatt = 0; } return fatt; } var GlobalInfoForBLFromLS=GetNothing(); YearPeriods896(FirstCall) { GlobalInfoForBLFromLS=GetNothing(); GlobalInfoForBLFromLS=CreateObject("KOtherEnterpriseReferenceBL"); var Periods = CreateObject("KDatePeriods"); Periods.Clear(); var kcp = CreateObject("KPeriodsIterations"); kcp.ClearAll(); string sd0=Str_Date_0, sd1=Str_Date_1; if ( FirstCall && AskPeriod(0x144," ਮ ᢥન")==ESC ) BreakTableReceive(); var Month = CreateObject("KMonth"); Month.SetDate(SysStrDateOneScript); int Year1 = Month.GetYear(); Month.SetDate(SysStrDateTwoScript); int Year2 = Month.GetYear(); for ( int Year=Year1; Year<=Year2; ++Year ) { string strYear = static_cast_to_string(Year); string D1 = "01.01."+strYear; string D2 = "31.12."+strYear; kcp.AddPeriod(strYear,D1,D2); Periods.Update(D1,D2); } GlobalInfoForBLFromLS.WorkPeriods()=Periods; GlobalInfoForBLFromLS.CollectFromLS("01.01."+to_string(Year1),"31.12."+to_string(Year2)); Str_Date_0=sd0, Str_Date_1=sd1; } GetSumm896LS(Year) { return IsNothing(GlobalInfoForBLFromLS)?0.:GlobalInfoForBLFromLS.GetYearInfo(atoi(to_string(Year))).Summa; } GetRv896LS(Year) { return IsNothing(GlobalInfoForBLFromLS)?0.:GlobalInfoForBLFromLS.GetYearInfo(atoi(to_string(Year))).ExcludeDays; } GetSumm896(Year) { return GetSummRv896(Year,0); } GetRv896(Year) { return GetSummRv896(Year,2); } GetSummRv896(Year,FlagRv) { char Buf[256]; GetCommonCnf("LST_NU_DRO","",Buf,255); var ArrayNU; int cntNU=ListNUToSafeArray(Buf,' ',ArrayNU); var Month = CreateObject("KMonth"); Month.SetMonthYear(1,static_cast_to_int(Year)); int absm1=Month.GetAbs(); Month.SetMonthYear(12,static_cast_to_int(Year)); int absm2=Month.GetAbs(); double Sum=0.; int Flag = 32+64+FlagRv; for ( int i=0; i1) { dat.SetDateD(GetDateFromFuncRWScript(Param.Get(1))); me=mb=dat.GetAbs()-mtek; } if (Param.Count()>2) { dat.SetDateD(GetDateFromFuncRWScript(Param.Get(2))); me=dat.GetAbs()-mtek; } //4 ࠬ - ᨬ char SimNal=''; if (Param.Count()>3) { char s[256]; s=Param.Get(3); SimNal=s[0]; } //5 ࠬ -, 砥 祭 ஥ dat.SetDateII(1,mb+mtek);//, 砥 祭 ஥ if (Param.Count()>4) dat.SetDate(Param.Get(4)); char Arg[256],Str[256]; sprintf(Arg,"4,1,%d,%d,*,*,%c,DateTaxCnf=%s",mb,me,SimNal,dat.GetStr()); R_Tax(Arg,Str,14,2); if (What=="") return atof(RTSx(4,14,2)) +atof(RTSx(80,14,2)); if (What=="।쭮") return atof(RTSx(160,14,2)) +atof(RTSx(161,14,2)); if (What=="࠭祭।쭮") return atof(RTSx(4,14,2)) +atof(RTSx(80,14,2)) -atof(RTSx(160,14,2)) -atof(RTSx(161,14,2)); if (What=="륂믫") return atof(res2("2200",14,2)) +atof(res2("2100",14,2)) +atof(RTSx(71,14,2)) -atof(RTSx(80,14,2)); if (What=="ᥣ᫥") return atof(RTSx(4,14,2)) +atof(res2("2200",14,2)) +atof(res2("2100",14,2)) +atof(RTSx(71,14,2)); return 0.0; } SendKvitokToEmail() { try { int sendEmail=GetCommonCnfInt("sendEmail","⮪"); //᫨ ப 㫥 if (sendEmail) { int obr_kv=atoi(GetVarValue("_")); int vib_kv=atoi(GetVarValue("_")); //᫨ ன 1 - ࠡ⪥ 1 ⪠ 뤠 if (atoi(obr_kv)==0) { bool askAboutSend=GetCommonCnfInt("sendEmail","⮪") & 0x01; ReLoadScriptModule("Check\\checksToEmail"); if ( !askAboutSend || askAboutSend && AmbaMessageBox("ࠢ ⪨ ?","",MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2, 0)==IDYES ) { kvitokToEmail=1; InitOffsets(vib_kv); } } //ࠢ塞 ⪨ if(kvitokToEmail) { CountOffsetsForKvitokToEmail++; //- ᬥ饭(⪮) var CFile=CreateObject("CurPrnFile"); OffsetsForKvitokToEmail[CountOffsetsForKvitokToEmail]=CFile.GetCountByte(); // ⪠ char tmp[256];kch_from("e_mail",tmp);FreeSpaceString(tmp,3,""); EmailsForKvitokToEmail [CountOffsetsForKvitokToEmail]=tmp;// ⮢ //䨮 kch_from("f",tmp); FreeSpaceString(tmp,3,""); string FIO=tmp+" "; kch_from("i",tmp); FreeSpaceString(tmp,3,""); FIO+=tmp+" "; kch_from("o",tmp); FreeSpaceString(tmp,3,""); FIO+=tmp; kch_from("tn",tmp);FreeSpaceString(tmp,3,""); TnFioForKvitokToEmail [CountOffsetsForKvitokToEmail]=to_string(tmp)+";"+FIO;// CheckMonthForKvitokToEmail[CountOffsetsForKvitokToEmail]=atoi(GetVarValue("_")); //᫨ ࠡ⠫ , if (atoi(obr_kv)+1==atoi(vib_kv)) Send_Checks(); //ࠢ塞 ⪨ } if (atoi(obr_kv)+1==atoi(vib_kv)) UnloadScriptModule("Check\\checksToEmail");//㦠 } } catch(...) { SayUndefinedScriptError(); UnloadScriptModule("Check\\checksToEmail");//㦠 return; } } var checkManager; PrintNetChecks(param) { return PriorityCall("UserPrintNetChecks","SysPrintNetChecks",param); } SysPrintNetChecks(param) { int checksProcessed=atoi(param.GetValue("ChecksProcessed")); int checksCount=atoi(param.GetValue("ChecksCount")); var modules=GetArray("check\\comcheck","check\\comprint"); try { if (checksProcessed==0) { var CFile=CreateObject("CurPrnFile"); // ꥪ ࠡ ⥪騬 䠩 CFile.SetFlagBrowse(0); // 頥 ᬮ CFile.SetFlag_Print(0); // ⥪⮢ 㦭 ReLoadSMs(modules); checkManager=NetDialogs().GetCheckManager(); checkManager.Init(param); } month_kv=atoi(param.GetValue("CheckMonth")); int month=month_kv; // ६ । :( checkManager.PrintCheck(month); // 䠩 ⪮ Excel var filePath=checkManager.GetCheckFilePath(); //஢ Excel->Html if (IsCheckAsHtml()) { var htmlFilePath=ConvertExcelToHtml(filePath); if(!StringIsEmpty(htmlFilePath)) filePath=htmlFilePath; } //ࠢ塞 ⮪ if( param.IsExist("ExcelPrintMode") && atoi(param.GetValue("ExcelPrintMode"))==2 && param.IsExist("CheckSaveOptions") && atoi(param.GetValue("CheckSaveOptions")) & 0x01 || atoi(param.GetValue("CheckSaveOptions")) & 0x02) SendNetCheck(filePath); if (checksProcessed+1>=atoi(checksCount)) { UnLoadSMs(modules); checkManager.EndPrint(); } } catch(...) { SayUndefinedScriptError(); UnLoadSMs(modules); } } IsCheckAsHtml() { return GetCommonCnfInt("prExcel","⮪") == 2; } ConvertExcelToHtml(excelFilePath) { try { //뢠 xls tPrepereOfficeForWork(); // ।塞 ࠡ Excel Calc (।塞 ᮢ (MS Office OpenOffice) ⠭ ।⥫쭥) tOpenXlsObjects(excelFilePath,(""));//뢠 ନ஢ ⮪ tGetWshByIndex(1); // 砥 뫪 (worksheet) tWshSelect(); string htmlFilePath=ChangeFileExt(excelFilePath,"htm"); if(!StringIsEmpty(htmlFilePath)) { //࠭塞 Excel HTM _XlsObj.ActiveWorkbook.PublishObjects.Add(1,htmlFilePath,_XlsObj.ActiveSheet.name); _XlsObj.ActiveWorkbook.PublishObjects(1).Publish(true); _XlsObj.ActiveWorkbook.PublishObjects(1).AutoRepublish=false; //뢠 Excel tEndXlsWork(0); //頥 htm 䠩 return htmlFilePath; } } catch(...) { tEndXlsWork(0); return ""; } } ChangeFileExt(filePath,newExt) { var fileInfo = CreateObject("FileInfo"); fileInfo.Init(to_string(filePath)); var currentExt=fileInfo.Extension(); if(strlen(currentExt)) return fileInfo.Directory()+fileInfo.Name()+"."+newExt; return filePath; } SendNetCheck(filePath) { // ன 㪠 ࠢ ⪨ if( GetCommonCnfInt("sendEmail","⮪")==0 ) return; //᫥ ࢮ ⪠ 뤠 ࠢ ⪮ if( 0==atoi(GetVarValue("_")) ) { ReLoadScriptModule("Check\\checksToEmail"); bool askAboutSend=GetCommonCnfInt("sendEmail","⮪") & 0x01; if ( !askAboutSend || askAboutSend && AmbaMessageBox("ࠢ ⪨ ?","",MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2, 0)==IDYES ) { kvitokToEmail=1; InitOffsets(0); } } //⪠ ࠢ if( !kvitokToEmail) return; string from="";// ࠢ⥫ 쬥 쪨 string email= kch_from_safe("e_mail"); var kd=KDateFromInt(atoi(GetVarValue("_"))); string subject =" " + kd.NameMonth(); // ᮮ饭 bool sendStatus=false; if( IsCheckAsHtml() ) { var htmlBody=ReadBodyFromHtml(filePath); sendStatus=NetDialogs().SendMailHtml(from,email,OemToAnsi(subject),htmlBody); } else sendStatus=NetDialogs().SendMailExcel(from,email,OemToAnsi(subject),OemToAnsi(subject),filePath); var htmlBody=ReadBodyFromHtml(filePath); var infoForLog=MakeLogInfo(to_string(kch_from_safe("tn")),to_string(GetFioFromKch()),email,sendStatus); AddLogFile(fileNameForLog,infoForLog); if ( atoi(GetVarValue("_"))+1==atoi(GetVarValue("_")) ) { AskAndShowLogChecks(); UnloadScriptModule("Check\\checksToEmail");//㦠 } } ReadBodyFromHtml(filePath) { unsigned long lpNumberOfBytesRead=0; int hf; char tmp[999999]; // 뢠 䠩 ⥭ if ((hf=CreateFile(filePath,-2147483648,1,0,3,128,0))!=-1) { double FileSize=SetFilePointer(hf,0,0,2); SetFilePointer(hf,0,0,0); ReadFile(hf,tmp,FileSize,lpNumberOfBytesRead,0); } CloseHandle(hf); return RTrimS(tmp); } CheckSumForTaxExist(strDatB,strDatE,&Arr) { return PriorityCall("UsrCheckSumForTaxExist","SysCheckSumForTaxExist",strDatB,strDatE,Arr); } SysCheckSumForTaxExist(strDatB,strDatE,&Arr) { char Arg[256],Str[256]; var DatB = CreateObject("KDate"); var DatE = CreateObject("KDate"); DatB.SetDateD(GetDateFromFuncRWScript(strDatB)); DatE.SetDateD(GetDateFromFuncRWScript(strDatE)); sprintf(Arg,"7,1,%d,%d,*,*,%d,DateTaxCnf=%s",DatB.GetRel(),DatE.GetRel(),Arr[0],DatB.GetStr()); R_Tax(Arg,Str,14,2); double Sum=atof(RTSx(4,14,2)); // atof(RTSx(160,14,2))+atof(RTSx(161,14,2)); // ॢ襭 // string str1=Str_Date_0; string str2=Str_Date_1; Str_Date_0=strDatB;//DatB.GetStr(); Str_Date_1=strDatE;//DatE.GetStr(); Sum+=atof(res2("2200",14,2))+atof(res2("2100",14,2))+atof(RTSx(71,14,2)); Str_Date_0=str1; Str_Date_1=str2; return Sum; } GetListPeriodsFromTabel(d1,d2,strSim) //頥 ᯨ᮪ " 砫"-" 砭"-"⢮ ";" 砫"-" 砭"-"⢮ "; .. { string rez=""; //.. ⮫쪮 ⠡ 㪠 ᨬ - 祭 ஥ MINUS_DNI MinusRV //।⥫쭮 ࠭ ⥪騥 祭 string oldMinusDni=GetCommonCnfStr("MINUS_DNI",""); string oldMinusRv=GetCommonCnfStr("MinusRV",""); try { SetCommonCnfInMem("MINUS_DNI",to_string(strSim),"_",'C',strlen(strSim),0); SetCommonCnfInMem("MinusRV","1","_",'C',1,0); int Holidays=0, MinusH=0, All=0; var ExclPeriods=CalcMinusDni(d1.GetStr(),d2.GetStr(),"_",d2.GetStr(),Holidays,MinusH,1,0,All); /* SetCommonCnfInMem("MINUS_DNI",to_string(strSim),"",'C',strlen(strSim),0); SetCommonCnfInMem("MinusRV","1","",'C',1,0); int Holidays=0, MinusH=0, All=0; var ExclPeriods=CalcMinusDni(d1.GetStr(),d2.GetStr(),"",d2.GetStr(),Holidays,MinusH,1,0,All);*/ int cntPer = ExclPeriods.Count(); //横 ਮ for ( ExclPeriods.SetBegin(); !ExclPeriods.End(); ExclPeriods.Next()) { string DBeg = (cntPer>0)?ExclPeriods.GetCurBeg().GetStr():"-"; string DEnd = (cntPer>0)?ExclPeriods.GetCurEnd().GetStr():"-"; int cntDays = (cntPer>0)?(ExclPeriods.GetCurEnd().Diff(ExclPeriods.GetCurBeg())+1):0; // 襬 ਮ char tmp[256]; sprintf(tmp,"%s-%s-%s;",DBeg,DEnd,to_string(cntDays)); rez+=tmp; } } catch(...) { ; } //⠭ 祭 SetCommonCnfInMem("MINUS_DNI",oldMinusDni,"",'C',strlen(oldMinusDni),0); SetCommonCnfInMem("MinusRV",oldMinusRv,"",'C',strlen(oldMinusRv),0); return rez; } AddCountToTableName(__AdrTable,__AdrMainTable,__MainTableRcr,text) { try { if ( __AdrMainTable ) { var Tabl = CreateObject("CurPrnTbl"); Tabl.Initial(__AdrTable); int count=Tabl.Count_Rcr(); var TablMain=CreateObject("CurPrnTbl"); TablMain.Initial(__AdrMainTable); if ( __MainTableRcr>=0 && __MainTableRcr=0 && __MainTableRcr ᫨ ⥪饣 ஥!=1 - 頥 ப //if(zpProjectNumber!=1 && __BankTemplateNumber==137) // return ""; // ௫ ஥⮢ return GetElementFromString(0,str,"^"); } int flagShowWarn_CardNumber=0; //뢠 ᮮ饭? GetAndCheckNotNull_CardNumber(kchField) { var value=kch_from_safe(kchField); if(strlen(value)<1 && !flagShowWarn_CardNumber) { char message[256]; sprintf(message," 㤭 \"%s\" 㪠 ⨪ !\n(ᥢ ஢ : %s)",GetFioFromKch(),kchField); MsgBoxCheck(OemToAnsi(message),OemToAnsi("!"),MB_OK|MB_ICONERROR,OemToAnsi(" 뢠 ᮮ饭"),flagShowWarn_CardNumber); } if(kchField=="bank_fss") return GetAccountInfoPilot("CardNum",value); // ௫ ஥⮢ return GetElementFromString(0,value,"^"); } GetDestinationBankBik() { var value=kch_from_safe(__DestinationBankBikKchField); return value; } GetFioFromKch() { char tmp[256],fio[256]; kch_from("f",tmp); FreeSpaceString(tmp,3,""); fio=tmp; kch_from("i",tmp); FreeSpaceString(tmp,3,""); fio+=" "+tmp; kch_from("o",tmp); FreeSpaceString(tmp,3,""); fio+=" "+tmp; return fio; } GetMestoRogd(version) { switch (atoi(version)) { case 1: { char tmp[256],str[256]; kch_from("gorod_r",tmp) ; str=RTrimS(tmp); kch_from("rajon_r",tmp) ; str += ", "+RTrimS(tmp); kch_from("oblast_r",tmp); str += ", "+RTrimS(tmp); kch_from("strana_r",tmp); str += ", "+RTrimS(tmp); return to_string(str); } default: // த,ࠩ,,࠭ { char tmp[256],str[256]; kch_from("gorod_r",tmp) ; FreeSpaceString(tmp,3,""); str=tmp; kch_from("rajon_r",tmp) ; FreeSpaceString(tmp,3,""); if ( tmp!="" ) str += ", "+tmp; kch_from("oblast_r",tmp); FreeSpaceString(tmp,3,""); if ( tmp!="" ) str += ", "+tmp; kch_from("strana_r",tmp); FreeSpaceString(tmp,3,""); if ( tmp!="" ) str += ", "+tmp; return to_string(str); } } } // । ᯨ᪠ ⠡ GetDirTransf(AdrCListTabl,RcrInList) { //। ⠡ ᯨ᪥ 蠡 var ListTabl = CreateObject("CurPrnTbl"); ListTabl.Initial(AdrCListTabl); int fld = ListTabl.Find_Name_Fld("KindForm"); if( fld==-1 ) return ""; int tableNum=atoi(ListTabl.Text(fld,RcrInList));// 蠡 return GetValueFromShablonList(tableNum,"DbfPath"); } GetValueFromShablonList(tableNum,FieldName) { //। Db_Main.Sum ( ⮬ "⥢ ਠ") char zplPath[256]; // zpl if (!IsLocalZPL()&& IsCommonResource(NameCommonDir())) GetCommonZPL(zplPath,255); else GetCurrentDirectory(255,zplPath); FreeSpaceString(zplPath,3,""); string dbMainPath=zplPath+"\\"+NameCommonDir()+"\\Db_Main.Sum"; //稬 祭 " 䠩 । ଠ樨 ⠡" var ShablonList = CreateObject("CurPrnTbl"); ShablonList.InitialNameFile(dbMainPath); int fldShablonNum = ShablonList.Find_Name_Fld("TableNum"); int fldValue=ShablonList.Find_Name_Fld(to_string(FieldName)); if( fldShablonNum==-1 || fldValue==-1 ) return ""; for(int i=0;i0 ? 4 : 0; sprintf(Str_Date_0,"%.10s",dateBeg); sprintf(Str_Date_1,"%.10s",dateEnd); if (AskPeriod(512+256+2+period,comment)==0) return ESC; dateBeg=Str_Date_0; dateEnd=Str_Date_1; strcpy(Str_Date_0,saveStrDate0); strcpy(Str_Date_1,saveStrDate1); } GetElementFromString(idx,str,delim) { var List = CreateObject("ParamFuncRW"); List.IInitial1(to_string(str),delim,255); if(List.Count()>idx) return List.Get(idx); return ""; } //version==0 //"" ࠭᫨ //version==1 - 52535.1-2006 //version==2 - 7.79-2000 (22.06.2000) SysTransliterationInit(version) { var mapKey = CreateObject("MapString"); mapKey.Clear(); switch (atoi(version)) { case 1: { mapKey.Add("","A"); mapKey.Add("","B"); mapKey.Add("","V"); mapKey.Add("","G"); mapKey.Add("","D"); mapKey.Add("","E"); mapKey.Add("","E"); mapKey.Add("","ZH"); mapKey.Add("","Z"); mapKey.Add("","I"); mapKey.Add("","I"); mapKey.Add("","K"); mapKey.Add("","L"); mapKey.Add("","M"); mapKey.Add("","N"); mapKey.Add("","O"); mapKey.Add("","P"); mapKey.Add("","R"); mapKey.Add("","S"); mapKey.Add("","T"); mapKey.Add("","U"); mapKey.Add("","F"); mapKey.Add("","KH"); mapKey.Add("","TS"); mapKey.Add("","CH"); mapKey.Add("","SH"); mapKey.Add("","SHCH"); mapKey.Add("","IE"); mapKey.Add("","Y"); mapKey.Add("",""); mapKey.Add("","E"); mapKey.Add("","IU"); mapKey.Add("","IA"); mapKey.Add("","A"); mapKey.Add("","B"); mapKey.Add("","V"); mapKey.Add("","G"); mapKey.Add("","D"); mapKey.Add("","E"); mapKey.Add("","E"); mapKey.Add("","ZH"); mapKey.Add("","Z"); mapKey.Add("","I"); mapKey.Add("","I"); mapKey.Add("","K"); mapKey.Add("","L"); mapKey.Add("","M"); mapKey.Add("","N"); mapKey.Add("","O"); mapKey.Add("","P"); mapKey.Add("","R"); mapKey.Add("","S"); mapKey.Add("","T"); mapKey.Add("","U"); mapKey.Add("","F"); mapKey.Add("","KH"); mapKey.Add("","TS"); mapKey.Add("","CH"); mapKey.Add("","SH"); mapKey.Add("","SHCH"); mapKey.Add("","IE"); mapKey.Add("","Y"); mapKey.Add("",""); mapKey.Add("","E"); mapKey.Add("","IU"); mapKey.Add("","IA"); break; } case 2: { mapKey.Add("","A"); mapKey.Add("","B"); mapKey.Add("","V"); mapKey.Add("","G"); mapKey.Add("","D"); mapKey.Add("","E"); mapKey.Add("","YO"); mapKey.Add("","ZH"); mapKey.Add("","Z"); mapKey.Add("","I"); mapKey.Add("","J"); mapKey.Add("","K"); mapKey.Add("","L"); mapKey.Add("","M"); mapKey.Add("","N"); mapKey.Add("","O"); mapKey.Add("","P"); mapKey.Add("","R"); mapKey.Add("","S"); mapKey.Add("","T"); mapKey.Add("","U"); mapKey.Add("","F"); mapKey.Add("","X"); mapKey.Add("","CZ"); mapKey.Add("","CH"); mapKey.Add("","SH"); mapKey.Add("","SHH"); mapKey.Add("","''"); mapKey.Add("","Y'"); mapKey.Add("","'"); mapKey.Add("","E'"); mapKey.Add("","YU"); mapKey.Add("","YA"); mapKey.Add("","A"); mapKey.Add("","B"); mapKey.Add("","V"); mapKey.Add("","G"); mapKey.Add("","D"); mapKey.Add("","E"); mapKey.Add("","YO"); mapKey.Add("","ZH"); mapKey.Add("","Z"); mapKey.Add("","I"); mapKey.Add("","J"); mapKey.Add("","K"); mapKey.Add("","L"); mapKey.Add("","M"); mapKey.Add("","N"); mapKey.Add("","O"); mapKey.Add("","P"); mapKey.Add("","R"); mapKey.Add("","S"); mapKey.Add("","T"); mapKey.Add("","U"); mapKey.Add("","F"); mapKey.Add("","X"); mapKey.Add("","CZ"); mapKey.Add("","CH"); mapKey.Add("","SH"); mapKey.Add("","SHH"); mapKey.Add("","''"); mapKey.Add("","Y'"); mapKey.Add("","'"); mapKey.Add("","E'"); mapKey.Add("","YU"); mapKey.Add("","YA"); break; } default: { mapKey.Add("","A"); mapKey.Add("","B"); mapKey.Add("","V"); mapKey.Add("","G"); mapKey.Add("","D"); mapKey.Add("","E"); mapKey.Add("","YO"); mapKey.Add("","G"); mapKey.Add("","Z"); mapKey.Add("","I"); mapKey.Add("","J"); mapKey.Add("","K"); mapKey.Add("","L"); mapKey.Add("","M"); mapKey.Add("","N"); mapKey.Add("","O"); mapKey.Add("","P"); mapKey.Add("","R"); mapKey.Add("","S"); mapKey.Add("","T"); mapKey.Add("","U"); mapKey.Add("","F"); mapKey.Add("","H"); mapKey.Add("","TZ"); mapKey.Add("","CH"); mapKey.Add("","SH"); mapKey.Add("","SCH"); mapKey.Add("",""); mapKey.Add("","Y"); mapKey.Add("",""); mapKey.Add("","E"); mapKey.Add("","YU"); mapKey.Add("","YA"); mapKey.Add("","A"); mapKey.Add("","B"); mapKey.Add("","V"); mapKey.Add("","G"); mapKey.Add("","D"); mapKey.Add("","E"); mapKey.Add("","YO"); mapKey.Add("","G"); mapKey.Add("","Z"); mapKey.Add("","I"); mapKey.Add("","J"); mapKey.Add("","K"); mapKey.Add("","L"); mapKey.Add("","M"); mapKey.Add("","N"); mapKey.Add("","O"); mapKey.Add("","P"); mapKey.Add("","R"); mapKey.Add("","S"); mapKey.Add("","T"); mapKey.Add("","U"); mapKey.Add("","F"); mapKey.Add("","H"); mapKey.Add("","TZ"); mapKey.Add("","CH"); mapKey.Add("","SH"); mapKey.Add("","SCH"); mapKey.Add("",""); mapKey.Add("","Y"); mapKey.Add("",""); mapKey.Add("","E"); mapKey.Add("","YU"); mapKey.Add("","YA"); break; } } return mapKey; } MakeFioLat(family,name,versionTransliteration,maxLen) { var mapKey = CreateObject("MapString");mapKey=SysTransliterationInit(versionTransliteration); char fam[256],famLat[256]; fam=family;famLat=""; for ( int i=0; imaxLen ) { imLat[1]='.'; imLat[2]=0; fioLat= to_string(imLat) + " " + to_string(famLat); } return fioLat; } // 1 . 0 //: // listFileds- , ( - ) AllFieldValuesIsNull(listFileds) { double eps=0.00001; // var subStrings = CreateObject("ParamFuncRW"); subStrings.IInitial(to_string(listFileds),";",255); var Tabl=CreateObject("CurPrnTbl"); int rcr=Tabl.Get_N_Rcr(); // // for(int fld=0;fldeps) return 0; } } } return 1; } GetKassVedNumber() { var ved = GetTekKassVed(); // "" var vedList = CreateObject("CurPrnTbl"); vedList.Initial(ved.GetAdrSpVed()); // int idxFld=vedList.Find_Name_Fld("PRINT_NUMB"); int rcr=vedList.Get_N_Rcr(); // . , vedList . string result=vedList.Text(idxFld,rcr); return result; } unsigned gWhichBLPilotFSS=0; string gPilotD1=""; string gPilotD2=""; AddInfoPilotToTableName(__AdrTable,__AdrMainTable,__MainTableRcr) { try { if ( __AdrMainTable ) { /* var Tabl = CreateObject("CurPrnTbl"); Tabl.Initial(__AdrTable); int FldSumm = Tabl.Find_Name_Fld(nameFld); if(FldSumm==-1) return; int Acc=Tabl.Accurasy_Fld(FldSumm); Tabl.Fill_Bottom_Text_1(); double Sum = atof(Tabl.Get_Bottom_Text(FldSumm)); */ var TablMain=CreateObject("CurPrnTbl"); TablMain.Initial(__AdrMainTable); if ( __MainTableRcr>=0 && __MainTableRcr=0 && __MainTableRcr20100000) D.SetInt(absm); else { D.SetDateII(1, absm); if ( TypeIteration== 1 ) D.SetDateII(D.CountDay(),absm); } int lenBuf=255; char Buf[lenBuf+1]; string strPodr; var tmp_comb = CreateObject("TmpCurCombine"); if (TypeOKTMO==5) { int combine= CodeNU>0?GetIDCombineOfCod(CodeNU): -to_int(CodeNU); tmp_comb.InitSimple(combine); strPodr = GetKchValue(ps_kch,Buf,lenBuf,D); if (StringIsEmpty(strPodr)) { int podr = IntegralPodrOfCombine(combine); // - // , .. GetOrgIDByKch if ( bCodOrgKch ) podr = GetOrgForPodr(podr); strPodr = to_string(podr); } } else strPodr = GetKchValue(ps_kch,Buf,lenBuf,D); return DefineOrgByKchValue(strPodr,bStringKch,bCodOrgKch); } else if ( TypeOKTMO==2 ) return GetOrgIDByCombine_NDFL(GetIDCombineOfCod(CodeNU)); else if ( TypeOKTMO==3 ) return GetOrgIDBySrc_NDFL(GetSrcOfCod(CodeNU)); else if ( TypeOKTMO==4 ) return GetOrgIDBySubject_NDFL(GetIDSubjectOfCod(CodeNU)); return !Poln_Tn?0:GetOrgForPodr(GetPodrCurrentLS()); } DefineParamsKchOKTMO(TypeOKTMO,&TypeIteration, &ps_kch, &bCodOrg, &bStringKch) { if ( TypeOKTMO!= 1 && TypeOKTMO!= 5 ) return; int TypeKch = GetCommonCnfInt("Type_kch","2ndfl"); // ਧ ࠧ ࣠権 bCodOrg = (TypeKch & 0x04) != 0; if ( bCodOrg ) TypeKch -= 4; bStringKch = (TypeKch & 0x08) != 0; if ( bStringKch) TypeKch -= 8; TypeIteration = TypeKch; char Buf[256]; GetCommonCnf("OKTMO_kch","2ndfl",Buf,255); FreeSpaceString(Buf,2,""); ps_kch = Buf; // ᫨ , ६ ⠢筮 "ࠧ" if ( ps_kch=="" ) ps_kch="podr"; } // 㭪 祭 (筮 ࠧ!) 頥 ID ࣠樨 // 㭪 ८। GetOrgIDByKch_NDFL(Podr) { return PriorityCall("UserGetOrgIDByKch_NDFL","SysGetOrgIDByKch_NDFL",Podr); } SysGetOrgIDByKch_NDFL(Podr) { int TypeKch = GetCommonCnfInt("Type_kch","2ndfl"); if ( (TypeKch & 0x04)!=0 ) return Podr; // , ᫨ ப 祭, 짮⥫᪠ // 㭪 UserGetOrgIDByKch_NDFL, ⮬ 窠 " 直 砩" if ( (TypeKch & 0x08)!=0 ) Podr = atoi(Podr); return GetOrgForPodr(Podr); } // 㭪 祭 . 頥 ID ࣠樨 // 㭪 ८। GetOrgIDByCombine_NDFL(Combine) { return PriorityCall("UserGetOrgIDByCombine_NDFL","SysGetOrgIDByCombine_NDFL",Combine); } SysGetOrgIDByCombine_NDFL(Combine) { return GetOrgForPodr(IntegralPodrOfCombine(Combine)); } // 㭪 祭 筨 頥 ID ࣠樨 // 㭪 ८। GetOrgIDBySrc_NDFL(Src) { return PriorityCall("UserGetOrgIDBySrc_NDFL","SysGetOrgIDBySrc_NDFL",Src); } var gIDOrgsSrcSubjCollectionNDFL = 0; // ࠭ ᯨ᪠ ᮮ⢥⢨ 筨 ꥪ - ID ࣠樨 SysGetOrgIDBySrc_NDFL(Src) { if ( !IsObject(gIDOrgsSrcSubjCollectionNDFL) ) { gIDOrgsSrcSubjCollectionNDFL = CreateObject("MapLong"); gIDOrgsSrcSubjCollectionNDFL.Clear(); } if ( gIDOrgsSrcSubjCollectionNDFL.IsExist(Src) ) return gIDOrgsSrcSubjCollectionNDFL.GetValue(Src); for ( int i=0; i= 0 && kch_comb(numKCH)) TypeOKTMO_NDFL = 5; } */ return TypeOKTMO_NDFL; } MakePaidIncomeCollection_6NDFL(MonthB,MonthE) { UnloadScriptModule("forms\\DefineEnterpriseID"); LoadScriptModule("forms\\DefineEnterpriseID"); var D1 = CreateObject("KDate"); D1.SetDateII(1,MonthB); var D2 = CreateObject("KDate"); D2.SetDateII(1,MonthE); D2.SetDateII(D2.CountDay(),MonthE); var kcp = CreateObject("KPeriodsIterations"); double Tax70=0.; var PaidsExt = CreateObject("PaidIncomeCollection"); PaidsExt.Initial(false); gTypeOKTMO_NDFL = DefineTypeOKTMO_NDFL(); AddInfoPart2_6NDFL(0,kcp,6,Tax70,D1,D2,PaidsExt); UnloadScriptModule("forms\\DefineEnterpriseID"); return PaidsExt; } FindSumElem(intCode,m,mv) { var LS = CreateObject("LS"); LS.GetGlobalLS(); var MatrLS = LS.MatrLS(); var be=MatrLS.GetBaseElemByCode(intCode); if (VarHasValue(be)) { var sumVect=be.SumVect; int index=sumVect.FindRow(m,mv); if (index>=0) return sumVect.GetSum(index); } // return GetEmpty(); Empty } // // return AddPayToSumExt(Extern_Cod, Month, MonthN, Sum, IdVed); // ! AddPayToSumExt(ExtCode, Month, MonthN, Sum, IdVed) { if (!AddPayToSum( Extern_To_InternE(atof(ExtCode)), absmec(GetDateFromFuncRWScript(Month)), absmec(GetDateFromFuncRWScript(MonthN)), Sum, IdVed)) BreakLineDelivery(); // RaiseError(", "); } AddPayToSum(intCode, m, mv, sum, IdVed) { var sumElem = FindSumElem(intCode,m,mv); if (!VarHasValue(sumElem)) return 0; struct PaidSumS paid; paid.IdVed=IdVed; paid.Sum=sum; sumElem.AddPay(paid); korrls=2; return 1; } DelPayFromSum(intCode, m, mv, IdVed) { bool changed = false; var sumElem = FindSumElem(intCode,m,mv); if (!VarHasValue(sumElem)) return 0; for(int i = 0; i=48 && //0 c<=57; //9 } GetOnlyDigits(str) { int len = strlen(str); char buf[len+1]; buf=str; char strDigits[len+1]; int idxDigits=0, idxStr=0; char curSimv=0; do { curSimv=buf[idxStr++]; if ( CharIsDigit(curSimv) ) strDigits[idxDigits++]=curSimv; } while (curSimv!=0); strDigits[idxDigits++]=0; return to_string(strDigits); } MapFromStr(str,Delimiter) { var Map=CreateObject("MapString"); Map.Clear(); var List = CreateObject("ParamFuncRW"); List.IInitial(to_string(str),Delimiter,9999); for(int i=0;i= 2017 && GetCommonCnfInt("ex2017","6ndfl") == 0 && reorgCode != "-1" ) bReorg = TrimN(reorgCode) != ""; else bReorg = Dat.GetYear() == DateEnd.GetYear() && quarter == quarterReorg; if (quarter == 1) return bReorg?"51":"21"; if (quarter == 2) return bReorg?"52":"31"; if (quarter == 3) return bReorg?"53":"33"; if (quarter == 4) return bReorg?"90":"34"; } GetCodPeriodRSV2017(strDate, strDateEnd) { return GetCodPeriod6NDFL(strDate, strDateEnd, "-1"); } // var NumbersSpravByOrgID = CreateObject("MapLong"); InitNumberSparvByOrgID(AdrTbl,psOrgID, psNum) { NumbersSpravByOrgID.Clear(); if ( AdrTbl!=0 ) { var T = CreateObject("CurPrnTbl"); T.Initial(AdrTbl); int FldOrg = T.Find_Name_Fld(psOrgID); int FldNum = T.Find_Name_Fld(psNum); if ( FldNum!=-1 ) for ( int Rcr=0; RcrCurNum ) NumbersSpravByOrgID.Add(OrgID,Num); } } } GetNumberSpravByOrgID(OrgID) { int Number = 0; // ! , . // , ! Number = NumbersSpravByOrgID.GetValue(OrgID); ++Number; NumbersSpravByOrgID.Add(OrgID,Number); return Number; } GetCount2NDFLInPack(Year) { int Count = GetCommonCnfInt("CountSprav","2ndfl"); // 2018 2- . // , " ", // . if ( Count<1 ) return Year<2018?3000:9999999; return Count; } int __BankTemplateNumber=0; string __CardNumberKchField="";//ᥢ .. ஬ ࠭ " " string __MobilePhoneKchField="";//ᥢ .. ஬ ࠭ " ⥫䮭" string __DestinationBankBikKchField="";//ᥢ .. ஬ ࠭ " ⥫" string __DestinationBankInnKchField="";//ᥢ .. ஬ ࠭ " ⥫" string __DestinationBankCardNumberKchField="";//ᥢ .. ஬ ࠭ "࠭/᢮ " DeliveryBankCardNumber(number,data,flags) //flags & 1 - <⮥> 祭 ࠧ; { var value=number; FreeSpaceString (value,3,""); if ((flags & 1) && !strlen(value) ) return; var deliveryDate=KDateFromStr(data); if(!deliveryDate.IsValid()) //᫨ 㪠 㪠 ୮ - ࠧᨬ ࢮ ᫮ ⥪. deliveryDate=KDateFromInt_WithDay(1,mtek); SetKchValue(__CardNumberKchField,value,deliveryDate); } StringIsEmpty(str) { return Str_Cmp(str,""," ")==0; } TcsDestinationBankBik() { var kchField=GetCommonCnfStr("DestBik","Tcs"); if(Str_Cmp(kchField," "," ")==0||kch_num_sys(kchField)==-1) return ""; return kch_from_safe(kchField); } TcsDestinationBankAccount() { var kchField=GetCommonCnfStr("DestCard","Tcs"); if(Str_Cmp(kchField," "," ")==0||kch_num_sys(kchField)==-1) return ""; return kch_from_safe(kchField); } GetBankGlobalDialogDataCurrentTable(reAskParamsIfEmpty) { string module="bank\\common"; bool moduleWasLoaded=false; if ( !ScriptCheckName("GetGlobalDataCurrentTable") ) { UnloadScriptModule(module); LoadScriptModule(module); moduleWasLoaded=true; } var rez=GetGlobalDataCurrentTable(reAskParamsIfEmpty); if(moduleWasLoaded) UnloadScriptModule(module); return rez; } GetBankDialogDataCurrentTable(reAskParamsIfEmpty) { string module="bank\\common"; bool moduleWasLoaded=false; if ( !ScriptCheckName("GetDialogDataCurrentTable") ) { UnloadScriptModule(module); LoadScriptModule(module); moduleWasLoaded=true; } var rez=GetDialogDataCurrentTable(reAskParamsIfEmpty); if(moduleWasLoaded) UnloadScriptModule(module); return rez; } BankCommon_ShowDialog() { string module="bank\\common"; bool moduleWasLoaded=false; if ( !ScriptCheckName("Bank_ShowDialog") ) { UnloadScriptModule(module); LoadScriptModule(module); moduleWasLoaded=true; } var rez=Bank_ShowDialog(); if(moduleWasLoaded) UnloadScriptModule(module); return rez; } ReLoadScriptModule(module) { UnloadScriptModule(module); LoadScriptModule(module); } ReLoadSMs(moduleArray) { for(int i=0;i0 && atof(summ)>0.001; } CombineRef(&buffer,bufsize,handle,&C_Params) { char ss[bufsize+1]; CharToOem(buffer,ss); int rc=ShowCombineRef(ss,ss, 2, 5, 70, 15); if (rc!=ESC) { sprintf(ss,"%04d",ExtCombineToInt(ss)); OemToChar(ss, buffer); return 1; } return 0; } TryEvaluate(script,&result) { try { var xm = CreateObject("XMachine"); result=xm.Evaluate(to_string(script)); return true; } catch(...) { ; } return false; } GetCommonCnfS(psVar,psTable) { if ( IsCommonCnfExist(psVar,psTable) ) { char Buf[256]; GetCommonCnf(psVar,psTable,Buf,255); FreeSpaceString(Buf,3,""); char tmp[256]; if(TryEvaluate(Buf,tmp) && tmp!="void") return to_string(tmp); return to_string(Buf); } return ""; } DefineKEmploy(combine,d) { return GetKoefEmployment(d,combine,0x01); /* var tmpComb=CreateObject("TmpCurCombine");tmpComb.Init(combine); // // double k_employ=1.; char strTemp[11]; GetKchValue("k_employ",strTemp,10,d); if (Str_Cmp(strTemp," "," ")!=0) k_employ=atof(strTemp); return k_employ; */ } ExcludeLongOtp(&DatBeg,&DatEnd,&Periods,&PeriodsExcl) { PeriodsExcl.Clear(); Periods.SetBegin(); int am=-1000; // . am. int ExistDopPF = -1; // -1 - , 0 - , 1 - . char BufFunc[256],buf[512]; // , . for ( ; !Periods.End(); Periods.Next() ) { var D1 = Periods.GetCurBeg(); var D2 = Periods.GetCurEnd(); if ( am>D2.GetAbs() ) continue; // // . // "" . if ( am'9' ) continue; Buf[idxtarget++]=c; } Buf[idxtarget]=0; return to_string(Buf); } NormalizationSnils(snils) // , : NNN-NNN-NNN NN. { int len = strlen(snils); char Buf[15]; int idxtarget=0; for ( int idx=0; idx'9' ) continue; Buf[idxtarget++]=c; } Buf[idxtarget]=0; return to_string(Buf); } GetLsMainProp() { return PriorityCall("UserGetLsMainProp","SysGetLsMainProp"); } SysGetLsMainProp() { var prop = CreateObject("APropBE"); // .. - int srcCode=GetGeneralSrcLS(); char tmp[256]; kch_from("itog_src",tmp); if (Str_Cmp(tmp,""," ")!=0) // srcCode=tmp[0]; // var CL=CreateObject("CombineList"); //srcCode=CL.GetSrc(GetGeneralCombineLS()); int subjectCode=GetGeneralSubjectLS(); int podr=CL.GetPodr(GetGeneralCombineLS()); // . if(podr<1)// podr=kch_from_int("podr"); prop.Init(srcCode,subjectCode,podr,GetGeneralCombineLS()); return prop; } GetKchStringByExtCombine(ps, dateStr, extCombine) { int idCombine = ExtCombineToInt(extCombine); var cur_combine; if (idCombine!=CLL_TOTAL_COMBINE) { cur_combine=CreateObject("TmpCurCombine"); cur_combine.Init(idCombine); } char value[256]; GetKchValue(ps, value, 255, KDateFromStr(dateStr)); return to_string(value); } AfterCorrPutRefValueByKey(strKey, strRef, keyFldRef, valueFldRef, valueNameFld, AdrTable) { char Buf[256]; GetValueClassif(strRef,strKey,Buf,255,valueFldRef,keyFldRef); TrimN(Buf); var CTabl = CreateObject("CurPrnTbl"); CTabl.Initial(AdrTable); int fldValue = CTabl.Find_Name_Fld(to_string(valueNameFld)); if (fldValue == -1 ) { MsgBox(" : " + valueNameFld,"", MB_OK|MB_ICONWARNING); return; } CTabl.SText(fldValue, CTabl.Get_N_Rcr(), to_string(Buf)); } BeforeCorrReferenceByValue(value, strRef, keyFldRef, valueFldRef, keyNameFld, AdrTable) { var CTabl = CreateObject("CurPrnTbl"); CTabl.Initial(AdrTable); int fldCode = CTabl.Find_Name_Fld(to_string(keyNameFld)); if (fldCode == -1 ) { MsgBox(" : " + keyNameFld,"", MB_OK|MB_ICONWARNING); return value; } // , fldCode int width = CTabl.Width_fld(fldCode); int rcr = CTabl.Get_N_Rcr(); char strKey[width + 1]; strcpy(strKey, RTrimS(CTabl.Text(fldCode, rcr))); if (SimpleRef(strRef,0,0,60,10,strKey,width,strKey,keyFldRef) == ESC) return value; CTabl.SText(fldCode, rcr, to_string(strKey)); char Buf[256]; GetValueClassif(strRef,strKey,Buf,255,valueFldRef,keyFldRef); TrimN(Buf); return to_string(Buf); } AfterCorrPutPodrName(podrCodeStr, podrNameFld, AdrTable) { int podrCode = atoi(podrCodeStr); string name = RTrimS(OtdNameByCod(podrCode)); var CTabl = CreateObject("CurPrnTbl"); CTabl.Initial(AdrTable); CTabl.STextS(podrNameFld, CTabl.Get_N_Rcr(), name, 0 /* silent*/); } PodrReferenceBeforeCorr(podrName, podrNameFld, podrCodeFld, AdrTable) { var CTabl = CreateObject("CurPrnTbl"); CTabl.Initial(AdrTable); int fldCode = CTabl.Find_Name_Fld(podrCodeFld); int fldName = CTabl.Find_Name_Fld(podrNameFld); if (fldCode == -1 || fldName == -1) { AmbaMessageBox(" : " + podrCodeFld + ", " + podrNameFld); return podrName; } // 㤥 ᪠ , ⮫ fldCode int width = CTabl.Width_fld(fldCode); int rcr = CTabl.Get_N_Rcr(); char podrCode[width + 1]; strcpy(podrCode, RTrimS(CTabl.Text(fldCode, rcr))); if (SimpleRef("DEPARTMENT",0,0,0,0,podrCode,width,podrCode,"C_PODR") == ESC) return podrName; CTabl.SText(fldCode, rcr, to_string(podrCode)); return OtdNameByCod(atoi(podrCode)); } AfterCorrPutDoljnNameAndId(doljnCodeStr, doljnNameFld, doljnIdFld, AdrTable) { var doljnElem = GetDoljnFromSpravByExtcode(RTrimS(doljnCodeStr)); if (!IsObject(doljnElem)) return; var CTabl = CreateObject("CurPrnTbl"); CTabl.Initial(AdrTable); int rcr = CTabl.Get_N_Rcr(); CTabl.STextS(doljnNameFld, rcr, doljnElem.GetName(), 0 /* silent*/); CTabl.STextS(doljnIdFld, rcr, to_string(doljnElem.GetID()), 0 /* silent*/); } AfterCorrDoljnPutPodrNameAndCode(doljnCodeStr, podrNameFld, podrCodeFld, AdrTable) { var doljnElem = GetDoljnFromSpravByExtcode(RTrimS(doljnCodeStr)); if (!IsObject(doljnElem)) return; var CTabl = CreateObject("CurPrnTbl"); CTabl.Initial(AdrTable); int rcr = CTabl.Get_N_Rcr(); int podr = doljnElem.GetPodr(); CTabl.STextS(podrCodeFld, rcr, to_string(podr), 0 /* silent*/); if (podr > 0) { string podrName = OtdNameByCod(podr); CTabl.STextS(podrNameFld, rcr, podrName, 0 /* silent*/); } else CTabl.STextS(podrNameFld, rcr, "", 0 /* silent*/); } CodeNUReference(strCodeNU, bExt) { int Len = strlen(strCodeNU); int MaxLen = 3*Len+1; // . char Buf[MaxLen]; Buf = strCodeNU; try // CodeNUReference { if (!bExt) ListNUIntToExt(Buf, MaxLen-1, ' '); if ( StrNURef(Buf, MaxLen-1, ' ', false)==ESC ) return strCodeNU; if (!bExt) ListNUExtToInt(Buf, MaxLen-1, ' '); } catch(...) { return strCodeNU; } Text_Text(strCodeNU, Buf, strlen(strCodeNU)); return strCodeNU; } DoljnReferenceNameBeforeCorr(doljnName, doljnNameFld, doljnCodeFld, doljnIdFld, AdrTable) { var CTabl = CreateObject("CurPrnTbl"); CTabl.Initial(AdrTable); int fldCode = CTabl.Find_Name_Fld(doljnCodeFld); int fldName = CTabl.Find_Name_Fld(doljnNameFld); int fldId = CTabl.Find_Name_Fld(doljnIdFld); if (fldCode == -1 || fldName == -1 || fldId == -1) { AmbaMessageBox(" : " + doljnNameFld + ", " + doljnCodeFld + ", " + doljnIdFld); return doljnName; } // 㤥 ᪠ , Id, ⮫ fldCode int width = CTabl.Width_fld(fldCode); int rcr = CTabl.Get_N_Rcr(); char doljnCode[width + 1]; strcpy(doljnCode,RTrimS(CTabl.Text(fldCode, rcr))); if (SimpleRef("DOLGNOST",0,0,0,0,doljnCode,width,doljnCode,"ShortName") == ESC) return doljnName; var doljnElem = GetDoljnFromSpravByExtcode(RTrimS(doljnCode)); if (!IsObject(doljnElem)) return doljnName; CTabl.SText(fldCode, rcr, to_string(doljnCode)); CTabl.SText(fldId, rcr, to_string(doljnElem.GetID())); return to_string(doljnElem.GetName()); } MakeKchStringValueBySOUT(spisok,sout) // ନ஢ ஢ ᯨ᪠ ᯥ.業 // spisok = 1 2, sout - , 3.1, 3.2, 3.3, 3.4, 4 { int numSpis = atoi(to_string(spisok)); if ( numSpis!=1 && numSpis!=2 ) return " "; char Buf[512]; Buf = RTrimS(sout); if ( Buf[0]=='B' || Buf[0]=='' || Buf[0]=='' || Buf[0]=='O' ) Buf[0]=' '; int numSout = to_int(atof(Buf)*10); if ( numSout ) return to_string(numSpis*100+numSout); return to_string(numSpis); } SysGetSummNuList(month,nuList,Flag) { var arr; int cntNu=ListNUToSafeArray(nuList,',',arr); if(cntNu<1) return 0.; return SysGetSummNuArr(month,arr,Flag,true); } SysGetSummNuArr(month,&arr,Flag,flagExt) { var Prop = GetCommonProp(CMN_SRC_REFS); var ts = CreateObject("TempCommonSrc"); ts.TempCommonSrcInitial(CMN_SRC_COUNT_LS); int cntNu = GetUBound(arr)+1; double rez=0.; for(int i=0;i0.0001 && (DopFlag & 0x02)) ) break; } return rez; } FiltrRowkod(&rowkod,&cntrow, absmes,Flag) //- rowkod absmes { bool filtrRow=Flag & 0x01; // absmes bool filtrZeroRow=Flag & 0x02; // int newCntRow=0; int NewRowkod[cntrow]; for (int row=0; rowc rowkod[row] NewRowkod NewRowkod[newCntRow++]=rowkod[row]; } for(int i=0;i 0 ) podrCombine = combList.GetPodr(combine); podr = podrCombine; } int idOrg = GetOrgForPodr(podr); if ( !VarHasValue(SysSetCodToListNUMap) || SysSetCodToListNUAbsMonth!=absm || SysSetCodToListNUIdOrg!=idOrg || SysSetCodToListNUNumSet!=numSet ) { SysSetCodToListNUMap = ReadSetka2ToMapListNU(idOrg,KDateFromInt_LastDay(absm),numSet,to_string(pseudKey),to_string(pseudNU)," ","","",0x03); SysSetCodToListNUAbsMonth = absm; SysSetCodToListNUIdOrg = idOrg; SysSetCodToListNUNumSet = numSet; } if ( !VarHasValue(SysSetCodToListNUMap) || !SysSetCodToListNUMap.IsExist(strKey) ) return 0.; string listNU = SysSetCodToListNUMap.GetValue(strKey); return SysGetSumByStrListNU(listNU,absm,Prop,Flag); } SysGetSumByStrListNU(listNU,absm,Prop,Flag) { bool byMNach = (Flag & 0x01)!=0; bool excludeSlaveCombines = (Flag & 0x02)!=0; var Arr; int cnt = StringIntToArray(listNU," ,",1,'-',Arr); if ( cnt == 0 ) return 0.; // , SysMapSlaveCombines if ( !SysFillSlaveCombines(Prop.GetCombine(),excludeSlaveCombines ? 0x01 : 0) && Prop.GetCombine() ) return 0.; double sum = 0.; for ( bool Cur = SysMapSlaveCombines.InitIterator(); Cur; Cur = SysMapSlaveCombines.Next() ) { int combine = SysMapSlaveCombines.GetCurValue(); Prop.SetCombine(combine); for ( int i = 0; i < cnt; i++ ) { int code = Arr[i]; sum += CollectSummProp(code,absm,absm, byMNach ? CL_MV : CL_M, Prop); } } return sum; } var VidInTaxCnfNoteCache; // ! : VidInTaxCnfNote(0, 0, 0); VidInTaxCnfNote(AlgTax, CodeNU, month) { string code = to_string(CodeNU); if (AlgTax == 0) { VidInTaxCnfNoteCache = CreateObject("MapString"); return ""; } else { if (VidInTaxCnfNoteCache.IsExist(code)) return VidInTaxCnfNoteCache.GetValue(code); } char BufFunc[256],buf[256]; if (IsNumeric(month) && month == 0) // _ 0 month = mtek; sprintf(BufFunc,AnsiToOem("_(%s,%s,%s,)"),to_string(AlgTax),to_string(Intern_To_Extern(CodeNU)), to_string(month)); CallFuncReceive(BufFunc,buf,255,0); var Par=CreateObject("ParamFuncRW"); Par.IInitial1(to_string(buf),",",5); string ret = ""; if (Par.Count() > 4) { //.IncomeCode, //.DeductionCod //.DiscountCode //.TaxTable, //.Other); if (atoi(Par.Get(0))) ret+= " " + Par.Get(0); if (atoi(Par.Get(1))) ret+= " " + Par.Get(1); if (atoi(Par.Get(2))) ret+= " " + Par.Get(2); if (IsSubStrPresent(Par.Get(4), AnsiToOem(""))) ret += AlgTax<238? "" : "."; // } VidInTaxCnfNoteCache.Add(code, AnsiToOem(ret)); return ret; } // [d1;d2] // ndflByMrasch - . GetSumMvWithKoefNepoln(absM,stolb,Simv,d1,d2,flagNU,tipNepoln, aprop, ndflByMrasch) { // double koefNepoln; int tmpMrasch=mrasch; double rezult=0.0; var LS = CreateObject("LS"); LS.GetGlobalLS(); var MatrLS = LS.MatrLS(); int size = MatrLS.Size(); // for (int index = 0; index 100); } DateBegFirstEnpNdfl(absm) // { var d = KDateFromInt_WithDay(1,atoi(static_cast_to_string(absm))); // , // c 2024 if ( d.GetYear()>=2024 ) return d.GetInt(); if ( d.GetYear()==2023 ) { if ( d.GetMonth()==1 ) return d.GetInt(); return KDateFromInt_WithDay(23,d.GetAbs()-1).GetInt(); } return 0; } DateEndFirstEnpNdfl(absm) // { var d = KDateFromInt_WithDay(1,atoi(static_cast_to_string(absm))); // , // if ( d.GetYear()>=2023 ) return KDateFromInt_WithDay(22,d.GetAbs()).GetInt(); return 0; } DateBegSecondEnpNdfl(absm) // { var d = KDateFromInt_WithDay(1,atoi(static_cast_to_string(absm))); // , // 2023 if ( d.GetYear()>2023 || (d.GetYear()==2023 && d.GetMonth()==12) ) return KDateFromInt_WithDay(23,d.GetAbs()).GetInt(); return 0; } DateEndSecondEnpNdfl(absm) // { var d = KDateFromInt_WithDay(1,atoi(static_cast_to_string(absm))); // , // 2023 if ( d.GetYear()>2023 || (d.GetYear()==2023 && d.GetMonth()==12) ) return KDateFromInt_WithDay(d.CountDay(),d.GetAbs()).GetInt(); return 0; } GetStrPeriodWithoutYear(d1,d2) { string rez=""; char Buf[21]; if ( VarHasValue(d1) && d1.IsValid() ) sprintf(Buf,"%02d.%02d",d1.GetDay(),d1.GetMonth()); else Buf=""; rez += Buf+" - "; if ( VarHasValue(d2) && d2.IsValid() ) sprintf(Buf,"%02d.%02d",d2.GetDay(),d2.GetMonth()); else Buf=""; rez += Buf; return rez; } StrInfoAboutENPSvod(sOper,flag) { return PriorityCall("UserStrInfoAboutENPSvod","SysStrInfoAboutENPSvod",sOper,flag); } SysStrInfoAboutENPSvod(sOper,flag) { // flag==0 - // ==1 - bool needInfoENP = (flag==0 && IsItTax(sOper.InternCod)); if ( !needInfoENP ) { needInfoENP = (flag&0x01)!=0 && IsCodeNach(sOper.InternCod) && !mnimvid(sOper.InternCod,-1); } if ( !needInfoENP ) return ""; int dateSum = sOper.dateSum; int absm = mtek; if ( dateSum ) { int beg1 = DateBegFirstEnpNdfl(absm); int end1 = DateEndFirstEnpNdfl(absm); if ( !beg1 || !end1) return ""; char Buf[256]; var d1 = CreateObject("KDate"), d2 = CreateObject("KDate"); d1.SetInt(beg1), d2.SetInt(end1); if ( dateSumend2 ) return Oem(""); else if ( beg2<=dateSum /*&& dateSum<=end2*/) { return "2"; sprintf(Buf,Oem("2 (%s)"),GetStrPeriodWithoutYear(d1,d2)); return to_string(Buf); } } return ""; } WriteSoutToKch(extComb,strDateBeg,sout,numWorkP,numSpis) { int IDCombine=ExtCombineToInt(extComb); var tmp=CreateObject("TmpCurCombine"); tmp.Init(IDCombine); FreeSpaceString(sout,3,""); FreeSpaceString(numWorkP,3,""); int iSout = 0; if ( sout=="3.1" ) iSout = 31; else if ( sout=="3.2" ) iSout = 32; else if ( sout=="3.3" ) iSout = 33; else if ( sout=="3.4" ) iSout = 34; else iSout = atoi(sout)*10; int iSpis = atoi(to_string(numSpis)); int cod = iSpis*100 + iSout; char Buf[256]; sprintf(Buf,"%d,%s",cod,numWorkP); SetKchValue("status3",Buf,KDateFromStr(strDateBeg)); } GetRasNormzarOnDate(columnIdx,date,prop,dop) { var kDate=KDateFromStr(date); if(!kDate.IsValid()) return 0.; int absMonth=kDate.GetAbs(); int tmpmrasch = mrasch; var ts3 = CreateObject("TempCommonSrc"); ts3.TempCommonSrcInitial(CMN_SRC_COUNT_LS); SetCommonProp(CMN_SRC_COUNT_LS,prop); if( tmpmrasch!=absMonth) s50all(absMonth); double normzar=0; var fags=0x02|0x04; ras_normzar( columnIdx,"*",0,fags,normzar,kDate); if( tmpmrasch!=absMonth) s50all(tmpmrasch); return normzar; } //todo KZ-5413 ( bank/mirpay.s ) FinalMirPay(AdrTable) { var tabl=CreateObject("CurPrnTbl"); tabl.Initial(AdrTable); var manager=NetDialogs().GetMirPayManager(); if( !IsObject(manager) || IsNothing(manager) ) return; manager.SaveDialogResult(tabl,__mirPayDialogResult); }