void browse_filesec(RDArsrc *mtnrsrc,filesecm *flsc) { RDArsrc *mainrsrc=NULL,*searchrsrc=NULL,*definelist=NULL; if(mtnrsrc!=NULL) free_rsrc(mtnrsrc); if(flsc!=NULL) { if(flsc->modlst!=NULL) freeapplib(flsc->modlst); if(flsc->file_defs!=NULL) freeapplib(flsc->file_defs); if(flsc->previous!=NULL) FreeRDATData(flsc->previous); Rfree(flsc); } mainrsrc=RDArsrcNEW(module,MTNMASTER->browse_screen); searchrsrc=RDArsrcNEW(module,MTNMASTER->search_browse); definelist=RDArsrcNEW(module,MTNMASTER->define_list); ZERNRD(filenum); addDFincvir(mainrsrc,module,"USERS",NULL,usernum); addDFincvir(mainrsrc,module,"MODSEC",NULL,modnum); addDFincvir(definelist,module,"FILESEC",NULL,filenum); addDFincvir(searchrsrc,module,"FILESEC",NULL,filenum); GET_SCREEN_VIRTUALS(mainrsrc,0); GET_SCREEN_VIRTUALS(definelist,1); GET_SCREEN_VIRTUALS(searchrsrc,2); ApplyPassKey(MTNMASTER->passkey); if(modnum!=(-1)) { COPYFIELD(filenum,modnum,"USER IDENTIFICATION"); COPYFIELD(filenum,modnum,"MODULE NAME"); if(EQLNRDsec(modnum,1)) { ZERNRD(modnum); } else { file2rsrc(modnum,mainrsrc,FALSE); filerecord2rsrc(modnum,mainrsrc); } if(usernum!=(-1)) { COPYFIELD(filenum,usernum,"USER IDENTIFICATION"); if(EQLNRDsec(usernum,1)) { ZERNRD(usernum); } else { file2rsrc(usernum,mainrsrc,FALSE); filerecord2rsrc(usernum,mainrsrc); } } } MakeRunFunction(mainrsrc,MTNMASTER); mbl_filesec=ADVPbrowse(filenum,MTNMASTER->passkey->keyno,mainrsrc,searchrsrc, definelist,doexit,okfunc,new_record,NULL,FALSE,NULL,0,0,2,0, MTNMASTER->passkey); }
void browse_mst(RDArsrc *mtnrsrc,RDATData *previous) { RDArsrc *mainrsrc=NULL,*searchrsrc=NULL,*definelist=NULL; if(mtnrsrc!=NULL) free_rsrc(mtnrsrc); if(previous!=NULL) FreeRDATData(previous); mainrsrc=RDArsrcNEW(MASTER->module,MASTER->browse_screen); searchrsrc=RDArsrcNEW(MASTER->module,MASTER->search_browse); definelist=RDArsrcNEW(MASTER->module,MASTER->define_list); ZERNRD(MASTER->passkey->fileno); ApplyPassKey(MASTER->passkey); GET_BROWSE_SUPPORTING(mainrsrc,searchrsrc,definelist,MASTER,SCRNvirtualSubData,(void *)mainrsrc); GET_SCREEN_VIRTUALS(mainrsrc,0); GET_SCREEN_VIRTUALS(definelist,1); GET_SCREEN_VIRTUALS(searchrsrc,2); if(dscnum!=(-1)) { COPYFIELD(MASTER->passkey->fileno,dscnum,"LEAVE DESCRIPTION IDENTIFICATION"); if(ADVEQLNRDsec(dscnum,1,SCRNvirtualSubData,mainrsrc)) { ZERNRD(dscnum); } else { file2rsrc(dscnum,mainrsrc,FALSE); filerecord2rsrc(dscnum,mainrsrc); if(lvetyp!=(-1)) { COPYFIELD(dscnum,lvetyp,"LEAVE TYPE IDENTIFICATION"); if(ADVEQLNRDsec(lvetyp,1,SCRNvirtualSubData,mainrsrc)) { ZERNRD(lvetyp); } else { file2rsrc(lvetyp,mainrsrc,FALSE); filerecord2rsrc(lvetyp,mainrsrc); } } } } MakeRunFunction(mainrsrc,MASTER); mbl_mst=ADVPbrowse(MASTER->passkey->fileno,MASTER->passkey->keyno,mainrsrc,searchrsrc, definelist,doexit,okfunc,new_record,NULL,FALSE,NULL,0,0,2,0, MASTER->passkey); }
static short getsupportingrecords(RDArsrc *mtnrsrc,short update,short display_diag) { short return_value=TRUE; char delflag=FALSE; if(dscnum!=(-1)) { COPYFIELD(MASTER->passkey->fileno,dscnum,"LEAVE DESCRIPTION IDENTIFICATION"); if(ADVEQLNRDsec(dscnum,1,SCRNvirtualSubData,mtnrsrc)) { KEYNRD(dscnum,1); if(display_diag) { WARNINGDIALOG("WARNING DIALOG SCREEN","INVALID LEAVE DESCRIPTION IDENTIFICATION!","The Leave Description Identification is an invalid value. It does not exist in the [LVEMGT][LVEDSC] data file. Please select a valid leave description identification to save this record.",NULL,NULL,TRUE,NULL); return_value=FALSE; } } else { if(display_diag) { FINDFLDGETCHAR(dscnum,"DELETEFLAG",&delflag); if(delflag) { WARNINGDIALOG("WARNING DIALOG SCREEN","DELETED LEAVE DESCRIPTION IDENTIFICATION!","The Leave Description Identification is in the state of deletion in the [LVEMGT][LVEDSC] data file. Please select a non-deleted leave description identification to save this record.",NULL,NULL,TRUE,NULL); return_value=FALSE; } if(lvetyp!=(-1)) { COPYFIELD(dscnum,lvetyp,"LEAVE TYPE IDENTIFICATION"); if(ADVEQLNRDsec(lvetyp,1,SCRNvirtualSubData,mtnrsrc)) KEYNRD(lvetyp,1); if(update) updatefilerecord2rsrc(lvetyp,mtnrsrc); else filerecord2rsrc(lvetyp,mtnrsrc); } } } if(update) updatefilerecord2rsrc(dscnum,mtnrsrc); else filerecord2rsrc(dscnum,mtnrsrc); } return(return_value); }
void addsortrecord(RDArsrc *mainrsrc,DBsort *dbsrt) { char deleteflag=FALSE; NRDkey *key=NULL; NRDpart *part; int x; FINDFLDSETCHAR(dbsrt->fileno,"DELETEFLAG",deleteflag); key=KEYNUM(payddsv,1); if(key!=NULL) { for(x=0,part=key->part;x<key->numparts;++x,++part) { COPYFIELD(payddsv,dbsrt->fileno,part->name); } } COPYFIELD(payddsv,dbsrt->fileno,"CHECK NUMBER"); COPYFIELD(payddsv,dbsrt->fileno,"VIRTUAL CHECK NUMBER"); COPYFIELD(payddsv,dbsrt->fileno,"DESCRIPTION"); COPYFIELD(payddsv,dbsrt->fileno,"CHECK DATE"); COPYFIELD(payddsv,dbsrt->fileno,"AMOUNT"); COPYFIELD(vennum,dbsrt->fileno,"VENDOR NAME"); COPYFIELD(vennum,dbsrt->fileno,"DEFAULT CHECK DETAIL"); if(VendorAddr1!=NULL) { VendorAddr1->computed=FALSE; computevirtual(VendorAddr1,SCRNvirtualSubData,mainrsrc); FINDFLDSETSTRING(dbsrt->fileno,"VENDOR ADDRESS 1",VendorAddr1->value.string_value); } if(VendorAddr2!=NULL) { VendorAddr2->computed=FALSE; computevirtual(VendorAddr2,SCRNvirtualSubData,mainrsrc); FINDFLDSETSTRING(dbsrt->fileno,"VENDOR ADDRESS 2",VendorAddr2->value.string_value); } if(VendorAddr3!=NULL) { VendorAddr3->computed=FALSE; computevirtual(VendorAddr3,SCRNvirtualSubData,mainrsrc); FINDFLDSETSTRING(dbsrt->fileno,"VENDOR ADDRESS 3",VendorAddr3->value.string_value); } WRTNRD(dbsrt->fileno,0,NULL); }
void setcheck(RDArsrc *mainrsrc) { short ef=0,increment_diagnostic=FALSE,payjpms_keyno=0; RangeScreen *rs=NULL; DBsort *sortfile=NULL; char *sortname=NULL,*perid=NULL,*last_perid=NULL,*e=NULL; char *bankid1=NULL,*payid1=NULL; RDArsrc *tmprsrc=NULL; int check_number=0,x=0; NRDpart *part; NRDkey *key=NULL; RDAvirtual *v; char deleteflag=FALSE,benefits_computed=FALSE; char cprinted=FALSE; /* char *libx=NULL,*temp1=NULL; */ double net=0; RDATData *prev_file=NULL; RDATData *prev=NULL; NRDfield *CNET=NULL; CNET=FLDNRD(payjpms,"CHECK NET"); readallwidgets(mainrsrc); FINDRSCGETSTRING(mainrsrc,"EXPRESSION",&vch_expression); FINDRSCGETSTRING(mainrsrc,"[PAYMSTR][PAY IDENTIFICATION]",&pay_id); if(banknum!=(-1)) { FINDRSCGETSTRING(mainrsrc,"[BNKACC][BANK IDENTIFICATION]",&bank_id); } sortname=unique_name(); sortfile=DBsortNEW(module,sortname,NRDRdaEngine); if(sortname!=NULL) Rfree(sortname); makeDBsortfile(sortfile); sortfile->fileno=OPNDBsort(sortfile); rs=RangeScreenNew(mainrsrc); ReadRangeScreen(payjpms,rs); ReadRangeScreen(payppms,rs); ReadRangeScreen(payjmst,rs); ReadRangeScreen(perdmg,rs); if(posmstr!=(-1)) { ReadRangeScreen(posmstr,rs); ReadRangeScreen(poslmst,rs); } if(mainrsrc->virflds!=NULL) { for(x=0,v=mainrsrc->virflds;x<mainrsrc->num;++x,++v) { ReadVirtualRangeStruct(v,rs); } } tmprsrc=diagscrn(payjpms,"DIAGNOSTIC SCREEN",module, "Setting Job Pay Masters....",NULL); if(tmprsrc!=NULL) { if(!ADVmakescrn(tmprsrc,TRUE)) { ForceWindowUpdate(tmprsrc); } else { e=Rmalloc(130+RDAstrlen(tmprsrc->module)+RDAstrlen(tmprsrc->screen)); sprintf(e,"The Make Screen function failed for the custom screen [%s] [%s]. Check to see the screen is available. If it is, call your installer.",tmprsrc->module,tmprsrc->screen); WARNINGDIALOG("WARNING DIALOG SCREEN","MAKESCRN FAILED",e,NULL,NULL,FALSE,NULL); prterr("Error %s.",e); if(e!=NULL) Rfree(e); } } payjpms_keyno=KEYNUMBER(payjpms,"RDA PAYJPMS KEY"); if(payjpms_keyno<1) payjpms_keyno=1; ZERNRD(payjpms); FINDFLDSETSTRING(payjpms,"PAY IDENTIFICATION",pay_id); ef=ADVGTENRDsec(payjpms,payjpms_keyno,SCRNvirtualSubData,mainrsrc); while(!ef) { FINDFLDGETSTRING(payjpms,"PAY IDENTIFICATION",&payid1); if(RDAstrcmp(payid1,pay_id)) break; increment_diagnostic=FALSE; FINDFLDGETCHAR(payjpms,"DELETEFLAG",&deleteflag); if(banknum!=(-1)) { if(!isEMPTY(bank_id)) { FINDFLDGETSTRING(payjpms,"BANK IDENTIFICATION",&bankid1); } } FINDFLDGETSTRING(payjpms,"PERSONNEL IDENTIFICATION",&perid); FINDFLDGETDOUBLE(payjpms,"CHECK NET",&net); if(net!=0.0 || CNET==NULL) { if(!deleteflag && !RDAstrcmp(bank_id,bankid1)) { FINDFLDSETSTRING(payppms,"PERSONNEL IDENTIFICATION",perid); FINDFLDSETSTRING(payppms,"PAY IDENTIFICATION",payid1); if(!ADVEQLNRDsec(payppms,1,SCRNvirtualSubData,mainrsrc)) { FINDFLDGETCHAR(payppms,"DELETEFLAG",&deleteflag); FINDFLDGETCHAR(payppms,"BENEFITS COMPUTED",&benefits_computed); FINDFLDGETCHAR(payppms,"CHECK PRINTED",&cprinted); if(!deleteflag && benefits_computed && !cprinted) { FINDFLDSETSTRING(payjmst,"PERSONNEL IDENTIFICATION",perid); COPYFIELD(payjpms,payjmst,"JOB NUMBER"); if(!ADVEQLNRDsec(payjmst,1,SCRNvirtualSubData,mainrsrc)) { FINDFLDGETCHAR(payjmst,"DELETEFLAG",&deleteflag); if(!deleteflag) { FINDFLDSETSTRING(perdmg,"PERSONNEL IDENTIFICATION",perid); if(!ADVEQLNRDsec(perdmg,1,SCRNvirtualSubData,mainrsrc)) { FINDFLDGETCHAR(perdmg,"DELETEFLAG",&deleteflag); if(!deleteflag) { if(!testfilerangersrc(payjpms,rs) && !testfilerangersrc(payjmst,rs) && !testfilerangersrc(payppms,rs) && !testfilerangersrc(perdmg,rs)) { if((check_postrk(mainrsrc,rs))==TRUE) { for(x=0,v=mainrsrc->virflds; x<mainrsrc->num;++x,++v) { if(ADVtestvirtualrangersrc(v,rs,(void (*)(...))SCRNvirtualSubData,mainrsrc)) break; } if(x>=mainrsrc->num) { if(vch_expression!=NULL) { if(EVALUATEbol(vch_expression, SCRNvirtualSubData, mainrsrc)) { if(csortsequence!=NULL) { computevirtual(csortsequence,SCRNvirtualSubData,mainrsrc); } addsortrecord(sortfile); increment_diagnostic=TRUE; } } else { if(csortsequence!=NULL) { computevirtual(csortsequence,SCRNvirtualSubData,mainrsrc); } addsortrecord(sortfile); increment_diagnostic=TRUE; } } } } } } } } } } } } if(tmprsrc!=NULL) update_diagnostic(tmprsrc,increment_diagnostic); if(bankid1!=NULL) Rfree(bankid1); CLEAR_SCREEN_VIRTUAL(mainrsrc); ef=ADVNXTNRDsec(payjpms,payjpms_keyno,SCRNvirtualSubData,mainrsrc); } if(payid1!=NULL) Rfree(payid1); if(tmprsrc!=NULL) { killwindow(tmprsrc); free_rsrc(tmprsrc); } if(rs!=NULL) FreeRangeScreen(rs); if(SIZNRD(sortfile->fileno)) { key=KEYNUM(payjpms,1); if(key!=NULL) { tmprsrc=diagscrn(sortfile->fileno,"DIAGNOSTIC SCREEN", module,"Setting Check Numbers...",NULL); if(tmprsrc!=NULL) { if(!ADVmakescrn(tmprsrc,TRUE)) { ForceWindowUpdate(tmprsrc); } else { e=Rmalloc(130+RDAstrlen(tmprsrc->module)+RDAstrlen(tmprsrc->screen)); sprintf(e,"The Make Screen function failed for the custom screen [%s] [%s]. Check to see the screen is available. If it is, call your installer.",tmprsrc->module,tmprsrc->screen); WARNINGDIALOG("WARNING DIALOG SCREEN","MAKESCRN FAILED",e,NULL,NULL,FALSE,NULL); prterr("Error %s.",e); if(e!=NULL) Rfree(e); } } check_number=start_check; ef=FRSNRD(sortfile->fileno,1); FINDFLDGETSTRING(sortfile->fileno,"PERSONNEL IDENTIFICATION", &perid); last_perid=stralloc(perid); LOCNRDFILE(banknum); while(!ef) { FINDFLDGETSTRING(sortfile->fileno,"PERSONNEL IDENTIFICATION",&perid); if(RDAstrcmp(last_perid,perid)) { if(last_perid!=NULL) Rfree(last_perid); ++check_number; last_perid=stralloc(perid); } for(x=0,part=key->part;x<key->numparts;++x,++part) COPYFIELD(sortfile->fileno,payjpms,part->name); if(!ADVEQLNRDsec(payjpms,1,SCRNvirtualSubData,mainrsrc)) { prev_file=RDATDataNEW(payjpms); FINDFLDSETINT(payjpms,"CHECK NUMBER",check_number); FINDFLDSETSTRING(payjpms,"CHECK DATE",check_date); ADVWRTTRANSsec(payjpms,0,NULL,prev_file,SCRNvirtualSubData,mainrsrc); DID_STUFF=TRUE; if(prev_file!=NULL) FreeRDATData(prev_file); } if(tmprsrc!=NULL) update_diagnostic(tmprsrc,TRUE); ef=NXTNRD(sortfile->fileno,1); } if(tmprsrc!=NULL) { killwindow(tmprsrc); free_rsrc(tmprsrc); } if(record_check_number==TRUE) { if(!ADVEQLNRDsec(banknum,1,SCRNvirtualSubData,mainrsrc)) { prev=RDATDataNEW(banknum); FINDFLDSETINT(banknum,"LAST CHECK NUMBER",check_number); ADVWRTTRANSsec(banknum,0,NULL,prev,SCRNvirtualSubData,mainrsrc); if(prev!=NULL) FreeRDATData(prev); } /* libx=Rmalloc(RDAstrlen(CURRENTDIRECTORY)+15); #ifdef WIN32 sprintf(libx,"%s\\%s\\",CURRENTDIRECTORY,"BNKREC"); #endif #ifndef WIN32 sprintf(libx,"%s/%s/",CURRENTDIRECTORY,"BNKREC"); #endif sprintf(stemp,"%s.CHK",(bank_id!=NULL ? bank_id:"")); temp1=adddashes(stemp); getnexttran(libx,temp1,check_number); if(temp1!=NULL) Rfree(temp1); if(libx!=NULL) Rfree(libx); */ } } UNLNRDFILE(banknum); } else { /* prterr("Error no Job Pay Masters selected."); */ ERRORDIALOG("Set Check Number Error","No check numbers were assigned for the selected pay identification. Please try again.",NULL,FALSE); } if(perid!=NULL) Rfree(perid); if(last_perid!=NULL) Rfree(last_perid); if(bankid1!=NULL) Rfree(bankid1); if(sortfile!=NULL) { CLSDBsort(sortfile); FreeDBsort(sortfile); } }
void addsortrecord(DBsort *dbsrt) { char deleteflag=FALSE; NRDkey *key=NULL; NRDpart *part; int x; FINDFLDSETCHAR(dbsrt->fileno,"DELETEFLAG",deleteflag); if(csortsequence!=NULL) { switch(csortsequence->type) { case SCROLLEDTEXT: case VARIABLETEXT: case DATES: case TIMES: case SOCSECNUM: case PLAINTEXT: case ZIPCODE: case PHONE: case CUSTOMTYPE: case EXPENDITURE: case REVENUE: case BALANCESHEET: case BEGINNINGBALANCE: case OPTIONALFIELDS: FINDFLDSETSTRING(dbsrt->fileno,csortsequence->name, csortsequence->value.string_value); break; case BOOLNS: case CHARACTERS: FINDFLDSETCHAR(dbsrt->fileno,csortsequence->name, *csortsequence->value.string_value); break; case DECIMALV: case DOUBLEV: case SDOUBLEV: case DOLLARS: case SDECIMALV: FINDFLDSETDOUBLE(dbsrt->fileno,csortsequence->name, *csortsequence->value.float_value); break; case SHORTV: case SSHORTV: FINDFLDSETSHORT(dbsrt->fileno,csortsequence->name, *csortsequence->value.short_value); break; case SCROLLEDLIST: case LONGV: case SLONGV: FINDFLDSETINT(dbsrt->fileno,csortsequence->name, *csortsequence->value.integer_value); break; default: prterr("Error virtual field type [%d] not found for field [%s].",csortsequence->type,csortsequence->name); break; } } key=KEYNUM(payjpms,1); if(key!=NULL) { for(x=0,part=key->part;x<key->numparts;++x,++part) { COPYFIELD(payjpms,dbsrt->fileno,part->name); } } WRTNRD(dbsrt->fileno,0,NULL); }
static gboolean direct_log(IPC_Channel* ch, gpointer user_data) { IPC_Message* ipcmsg; GMainLoop* loop; int pri = LOG_DEBUG + 1; loop =(GMainLoop*)user_data; while(ch->ops->is_message_pending(ch)){ if (ch->ch_status == IPC_DISCONNECT){ cl_log(LOG_ERR, "read channel is disconnected:" "something very wrong happened"); return FALSE; } ipcmsg = getIPCmsg(ch); if (ipcmsg == NULL){ return TRUE; } if( ipcmsg->msg_body && ipcmsg->msg_len > 0 ){ LogDaemonMsgHdr *logmsghdr; LogDaemonMsgHdr copy; char *msgtext; logmsghdr = (LogDaemonMsgHdr*) ipcmsg->msg_body; /* this copy nonsense is here because apparently ia64 * complained about "unaligned memory access. */ #define COPYFIELD(copy, msg, field) memcpy(((u_char*)©.field), ((u_char*)&msg->field), sizeof(copy.field)) COPYFIELD(copy, logmsghdr, use_pri_str); COPYFIELD(copy, logmsghdr, entity); COPYFIELD(copy, logmsghdr, entity_pid); COPYFIELD(copy, logmsghdr, timestamp); COPYFIELD(copy, logmsghdr, priority); /* Don't want to copy the following message text */ msgtext = (char *)logmsghdr + sizeof(LogDaemonMsgHdr); cl_direct_log(copy.priority, msgtext , copy.use_pri_str , copy.entity, copy.entity_pid , copy.timestamp); if (copy.priority < pri) pri = copy.priority; (void)logd_log; /* if (verbose){ logd_log("%s[%d]: %s %s\n", logmsg->entity[0]=='\0'? "unknown": copy.entity, copy.entity_pid, ha_timestamp(copy.timestamp), msgtext); } */ if (ipcmsg->msg_done){ ipcmsg->msg_done(ipcmsg); } } } /* current message backlog processed, * about to return to mainloop, * fflush and potentially fsync stuff */ cl_log_do_fflush(pri <= LOG_ERR); if(needs_shutdown) { cl_log(LOG_INFO, "Exiting write process"); g_main_quit(loop); return FALSE; } return TRUE; }
void xUpdateRealEstate(short taxdwr,short rstmst,short rstnew, short rstrn,short rstpd,double amount,void (*SubFunc)(...), void *args,int line,char *file) { RDATData *prev=NULL; double total=0.0; int x=0,numflds=0,trantype=0,yearid=0,trans=0,paynum=(-1); short pmonth=0,ef=FALSE; char *temp=NULL,*realestateid=NULL,*ownerid=NULL,dist=FALSE; NRDfield *fields=NULL,*field=NULL; #ifdef USE_RDA_DIAGNOSTICS if(diagmix) { if(rstpd!=(-1)) { prterr("DIAG UpdateRealEstatePayments at line [%d] program [%s].",line,file); } else { prterr("DIAG UpdateRealEstateTransactions at line [%d] program [%s].",line,file); } } #endif /* ifdef USE_RDA_DIAGNOSTICS */ if(rstpd!=(-1)) { trantype=3; FINDFLDGETSHORT(rstpd,"PROCESSING MONTH",&pmonth); FINDFLDGETSTRING(rstpd,"REAL ESTATE IDENTIFICATION",&realestateid); FINDFLDGETSTRING(rstpd,"OWNER IDENTIFICATION",&ownerid); FINDFLDGETINT(rstpd,"TAX YEAR",&yearid); FINDFLDGETINT(rstpd,"TRANSACTION NUMBER",&trans); FINDFLDGETINT(rstpd,"PAYMENT NUMBER",&paynum); FIELDCOPY(rstpd,"ENTRY DATE",rstmst,"LAST PAID DATE"); FINDFLDSETSTRING(rstrn,"REAL ESTATE IDENTIFICATION",realestateid); FINDFLDSETSTRING(rstrn,"OWNER IDENTIFICATION",ownerid); FINDFLDSETINT(rstrn,"TAX YEAR",yearid); FINDFLDSETINT(rstrn,"TRANSACTION NUMBER",trans); LOCNRDFILE(rstrn); if(SubFunc!=NULL) ef=ADVEQLNRDsec(rstrn,1,SubFunc,args); else ef=EQLNRDsec(rstrn,1); if(!ef) { prev=RDATDataNEW(rstrn); FINDFLDGETDOUBLE(rstrn,"OUTSTANDING AMOUNT",&total); total-=amount; FINDFLDSETDOUBLE(rstrn,"OUTSTANDING AMOUNT",total); if(SubFunc!=NULL) ADVWRTTRANSsec(rstrn,0,NULL,prev,SubFunc,args); else WRTTRANSsec(rstrn,0,NULL,prev); if(prev!=NULL) FreeRDATData(prev); } else { prterr("Error Real Estate Transaction Master not found for Payment Record [%s][%s][%d][%d][%d] at line [%d] program [%s].",realestateid,ownerid,yearid,trans,paynum,line,file); } UNLNRDFILE(rstrn); FINDFLDGETCHAR(rstpd,"CASHED OUT",&dist); FINDFLDGETSTRING(rstpd,"CASH DRAWER",&temp); if(!dist && !isEMPTY(temp)) { if(taxdwr!=(-1)) { FINDFLDSETSTRING(taxdwr,"CASH DRAWER",temp); LOCNRDFILE(taxdwr); if(SubFunc!=NULL) ef=ADVEQLNRDsec(taxdwr,1,SubFunc,args); else ef=EQLNRDsec(taxdwr,1); if(!ef) { prev=RDATDataNEW(taxdwr); FINDFLDGETDOUBLE(taxdwr,"COLLECTED AMOUNT",&total); total=total+amount; FINDFLDSETDOUBLE(taxdwr,"COLLECTED AMOUNT",total); if(SubFunc!=NULL) ADVWRTTRANSsec(taxdwr,0,NULL,prev,SubFunc,args); else WRTTRANSsec(taxdwr,0,NULL,prev); if(prev!=NULL) FreeRDATData(prev); } UNLNRDFILE(taxdwr); } } } else { FINDFLDGETSTRING(rstrn,"REAL ESTATE IDENTIFICATION",&realestateid); FINDFLDGETSTRING(rstrn,"OWNER IDENTIFICATION",&ownerid); FINDFLDGETINT(rstrn,"TAX YEAR",&yearid); FINDFLDGETINT(rstrn,"TRANSACTION TYPE",&trantype); FINDFLDGETSHORT(rstrn,"MONTH",&pmonth); } FINDFLDSETSTRING(rstmst,"REAL ESTATE IDENTIFICATION",realestateid); FINDFLDSETSTRING(rstmst,"OWNER IDENTIFICATION",ownerid); FINDFLDSETINT(rstmst,"TAX YEAR",yearid); total=0.0; LOCNRDFILE(rstmst); if(SubFunc!=NULL) ef=ADVEQLNRDsec(rstmst,1,SubFunc,args); else ef=EQLNRDsec(rstmst,1); if(!ef) { prev=RDATDataNEW(rstmst); if(rstnew!=(-1) && !trantype) { FINDFLDSETSTRING(rstnew,"REAL ESTATE IDENTIFICATION", realestateid); FINDFLDSETSTRING(rstnew,"OWNER IDENTIFICATION",ownerid); if(SubFunc!=NULL) ef=ADVEQLNRDsec(rstnew,1,SubFunc,args); else ef=EQLNRDsec(rstnew,1); if(!ef) { COPYFIELD(rstnew,rstmst,"LAND VALUE"); COPYFIELD(rstnew,rstmst,"BUILDING AND IMPROVEMENT VALUE"); } } } else { KEYNRD(rstmst,1); prev=NULL; if(rstnew!=(-1)) { FINDFLDSETSTRING(rstnew,"REAL ESTATE IDENTIFICATION", realestateid); FINDFLDSETSTRING(rstnew,"OWNER IDENTIFICATION",ownerid); if(SubFunc!=NULL) ef=ADVEQLNRDsec(rstnew,1,SubFunc,args); else ef=EQLNRDsec(rstnew,1); if(!ef) { numflds=NUMFLDS(rstnew); fields=FLDPOINTER(rstnew); if(fields!=NULL) { for(x=0,field=fields;x<numflds;++x,++field) { COPYFIELD(rstnew,rstmst,field->name); } } FIELDCOPY(rstnew,"ADDRESS 1",rstmst,"STATEMENT ADDRESS 1"); FIELDCOPY(rstnew,"ADDRESS 2",rstmst,"STATEMENT ADDRESS 2"); FIELDCOPY(rstnew,"CITY",rstmst,"STATEMENT CITY"); FIELDCOPY(rstnew,"STATE",rstmst,"STATEMENT STATE"); FIELDCOPY(rstnew,"ZIP",rstmst,"STATEMENT ZIP CODE"); } } } if(rstpd!=(-1)) trantype=3; temp=MakeRealEstateField(trantype); if(temp!=NULL) { FINDFLDGETDOUBLE(rstmst,temp,&total); total+=amount; FINDFLDSETDOUBLE(rstmst,temp,total); Rfree(temp); } if(SubFunc!=NULL) ADVWRTTRANSsec(rstmst,0,NULL,prev,SubFunc,args); else WRTTRANSsec(rstmst,0,NULL,prev); if(prev!=NULL) FreeRDATData(prev); UNLNRDFILE(rstmst); if(realestateid!=NULL) Rfree(realestateid); if(ownerid!=NULL) Rfree(ownerid); }
void setcheck(RDArsrc *mainrsrc) { short ef=0,increment_diagnostic=FALSE; RangeScreen *rs=NULL; DBsort *sortfile=NULL; char *sortname=NULL,*bankid1=NULL; int checknum=0; RDArsrc *tmprsrc=NULL; int x=0; RDAvirtual *v; char manual_voucher=FALSE,deleteflag=FALSE,verified=FALSE; char electronic=FALSE; /* char cleared=FALSE; char distributed=FALSE; */ DFvirtual *d=NULL; d=getDFvirtual("VENPMT","VENDOR ADDRESS 1"); if(d!=NULL) { VendorAddr1=Rmalloc(sizeof(RDAvirtual)); VendorAddr1->name=stralloc(d->name); VendorAddr1->when=0; VendorAddr1->len=d->length; VendorAddr1->type=d->type; if(d->expression!=NULL) { VendorAddr1->expression=PP_translate(d->expression); } else { VendorAddr1->expression=NULL; } VendorAddr1->computed=FALSE; VendorAddr1->range=FALSE; VendorAddr1->dlen=0; switch(VendorAddr1->type) { case SCROLLEDTEXT: case VARIABLETEXT: case DATES: case TIMES: case SOCSECNUM: case PLAINTEXT: case ZIPCODE: case PHONE: case CUSTOMTYPE: case EXPENDITURE: case REVENUE: case BALANCESHEET: case BEGINNINGBALANCE: case OPTIONALFIELDS: VendorAddr1->value.string_value=NULL; VendorAddr1->dlen=0; break; case BOOLNS: case CHARACTERS: VendorAddr1->value.string_value=Rmalloc(1); *VendorAddr1->value.string_value=0; VendorAddr1->dlen=1; break; case DECIMALV: case DOUBLEV: case SDOUBLEV: case DOLLARS: case SDECIMALV: VendorAddr1->value.float_value=Rmalloc(sizeof(double)); *VendorAddr1->value.float_value=0; VendorAddr1->dlen=sizeof(double); break; case SHORTV: case SSHORTV: VendorAddr1->value.short_value=Rmalloc(sizeof(short)); *VendorAddr1->value.short_value=0; VendorAddr1->dlen=sizeof(short); break; case SCROLLEDLIST: case LONGV: case SLONGV: VendorAddr1->value.integer_value=Rmalloc(sizeof(int)); *VendorAddr1->value.integer_value=0; VendorAddr1->dlen=sizeof(int); break; default: prterr("Error virtual field type [%d] not found for field [%s].",VendorAddr1->type,VendorAddr1->name); break; } FreeDFvirtual(d); } d=getDFvirtual("VENPMT","VENDOR ADDRESS 2"); if(d!=NULL) { VendorAddr2=Rmalloc(sizeof(RDAvirtual)); VendorAddr2->name=stralloc(d->name); VendorAddr2->when=0; VendorAddr2->len=d->length; VendorAddr2->type=d->type; if(d->expression!=NULL) { VendorAddr2->expression=PP_translate(d->expression); } else { VendorAddr2->expression=NULL; } VendorAddr2->computed=FALSE; VendorAddr2->range=FALSE; VendorAddr2->dlen=0; switch(VendorAddr2->type) { case SCROLLEDTEXT: case VARIABLETEXT: case DATES: case TIMES: case SOCSECNUM: case PLAINTEXT: case ZIPCODE: case PHONE: case CUSTOMTYPE: case EXPENDITURE: case REVENUE: case BALANCESHEET: case BEGINNINGBALANCE: case OPTIONALFIELDS: VendorAddr2->value.string_value=NULL; VendorAddr2->dlen=0; break; case BOOLNS: case CHARACTERS: VendorAddr2->value.string_value=Rmalloc(1); *VendorAddr2->value.string_value=0; VendorAddr2->dlen=1; break; case DECIMALV: case DOUBLEV: case SDOUBLEV: case DOLLARS: case SDECIMALV: VendorAddr2->value.float_value=Rmalloc(sizeof(double)); *VendorAddr2->value.float_value=0; VendorAddr2->dlen=sizeof(double); break; case SHORTV: case SSHORTV: VendorAddr2->value.short_value=Rmalloc(sizeof(short)); *VendorAddr2->value.short_value=0; VendorAddr2->dlen=sizeof(short); break; case SCROLLEDLIST: case LONGV: case SLONGV: VendorAddr2->value.integer_value=Rmalloc(sizeof(int)); *VendorAddr2->value.integer_value=0; VendorAddr2->dlen=sizeof(int); break; default: prterr("Error virtual field type [%d] not found for field [%s].",VendorAddr2->type,VendorAddr2->name); break; } FreeDFvirtual(d); } d=getDFvirtual("VENPMT","VENDOR ADDRESS 3"); if(d!=NULL) { VendorAddr3=Rmalloc(sizeof(RDAvirtual)); VendorAddr3->name=stralloc(d->name); VendorAddr3->when=0; VendorAddr3->len=d->length; VendorAddr3->type=d->type; if(d->expression!=NULL) { VendorAddr3->expression=PP_translate(d->expression); } else { VendorAddr3->expression=NULL; } VendorAddr3->computed=FALSE; VendorAddr3->range=FALSE; VendorAddr3->dlen=0; switch(VendorAddr3->type) { case SCROLLEDTEXT: case VARIABLETEXT: case DATES: case TIMES: case SOCSECNUM: case PLAINTEXT: case ZIPCODE: case PHONE: case CUSTOMTYPE: case EXPENDITURE: case REVENUE: case BALANCESHEET: case BEGINNINGBALANCE: case OPTIONALFIELDS: VendorAddr3->value.string_value=NULL; VendorAddr3->dlen=0; break; case BOOLNS: case CHARACTERS: VendorAddr3->value.string_value=Rmalloc(1); *VendorAddr3->value.string_value=0; VendorAddr3->dlen=1; break; case DECIMALV: case DOUBLEV: case SDOUBLEV: case DOLLARS: case SDECIMALV: VendorAddr3->value.float_value=Rmalloc(sizeof(double)); *VendorAddr3->value.float_value=0; VendorAddr3->dlen=sizeof(double); break; case SHORTV: case SSHORTV: VendorAddr3->value.short_value=Rmalloc(sizeof(short)); *VendorAddr3->value.short_value=0; VendorAddr3->dlen=sizeof(short); break; case SCROLLEDLIST: case LONGV: case SLONGV: VendorAddr3->value.integer_value=Rmalloc(sizeof(int)); *VendorAddr3->value.integer_value=0; VendorAddr3->dlen=sizeof(int); break; default: prterr("Error virtual field type [%d] not found for field [%s].",VendorAddr3->type,VendorAddr3->name); break; } FreeDFvirtual(d); } readallwidgets(mainrsrc); FINDRSCGETSTRING(mainrsrc,"[BNKACC][BANK IDENTIFICATION]",&bank_id); FINDRSCGETSTRING(mainrsrc,"OUTPUT DEVICE",&output_device); FINDRSCGETINT(mainrsrc,"BODY COUNT",&BODY_COUNT); FINDRSCGETCHAR(mainrsrc,"USE CHECK OFFSET",&use_check_offset); FINDRSCGETCHAR(mainrsrc,"USE HIGH AMOUNT",&use_high_amount); sortname=unique_name(); sortfile=DBsortNEW("PAYROLL",sortname,NRDRdaEngine); if(sortname!=NULL) Rfree(sortname); makeDBsortfile(sortfile); sortfile->fileno=OPNDBsort(sortfile); rs=RangeScreenNew(mainrsrc); ReadRangeScreen(payddsv,rs); if(mainrsrc->virflds!=NULL) { for(x=0,v=mainrsrc->virflds;x<mainrsrc->num;++x,++v) { ReadVirtualRangeStruct(v,rs); } } tmprsrc=diagscrn(payddsv,"DIAGNOSTIC SCREEN",module, "Selecting Vendor Vouchers",NULL); if(tmprsrc!=NULL) if(!APPmakescrn(tmprsrc,TRUE,NULL,NULL,FALSE)) ForceWindowUpdate(tmprsrc); ef=ADVBEGNRDsec(payddsv,SCRNvirtualSubData,mainrsrc); while(!ef) { increment_diagnostic=FALSE; FINDFLDGETCHAR(payddsv,"SOURCE USER VERIFIED",&verified); FINDFLDGETCHAR(payddsv,"MANUAL VOUCHER",&manual_voucher); FINDFLDGETCHAR(payddsv,"DELETEFLAG",&deleteflag); FINDFLDGETCHAR(payddsv,"ELECTRONIC TRANSFER",&electronic); /* FINDFLDGETCHAR(payddsv,"BNKREC UPDATED",&cleared); FINDFLDGETCHAR(payddsv,"DISTRIBUTED",&distributed); if(verified && !cleared && !manual_voucher && !electronic && !deleteflag && !distributed) */ if(verified && !manual_voucher && !electronic && !deleteflag) { if(banknum!=(-1)) { if(bank_id!=NULL) { FINDFLDGETSTRING(payddsv,"BANK IDENTIFICATION",&bankid1); } } if(!RDAstrcmp(bank_id,bankid1)) { FINDFLDGETINT(payddsv,"CHECK NUMBER",&checknum); if(checknum>0) { COPYFIELD(payddsv,vennum,"VENDOR IDENTIFICATION"); if(!ADVEQLNRDsec(vennum,1,SCRNvirtualSubData,mainrsrc)) { FINDFLDGETCHAR(vennum,"DELETEFLAG", &deleteflag); if(!deleteflag) { COPYFIELD(payddsv,venadr,"VENDOR IDENTIFICATION"); COPYFIELD(payddsv,venadr,"ADDRESS IDENTIFICATION"); if(!ADVEQLNRDsec(venadr,1,SCRNvirtualSubData,mainrsrc)) { FINDFLDGETCHAR(venadr,"DELETEFLAG", &deleteflag); if(!deleteflag) { COPYFIELD(payddsv,ddsnum,"DEDUCTION DESCRIPTION IDENTIFICATION"); if(!ADVEQLNRDsec(ddsnum,1,SCRNvirtualSubData,mainrsrc)) { FINDFLDGETCHAR(ddsnum,"DELETEFLAG", &deleteflag); if(!deleteflag) { if(!testfilerangersrc(payddsv,rs)/* && !testfilerangersrc(vennum,rs)*/) { for(x=0,v=mainrsrc->virflds; x<mainrsrc->num;++x,++v) { if(ADVtestvirtualrangersrc(v,rs,(void (*)(...))SCRNvirtualSubData,mainrsrc)) { break; } } if(x>=mainrsrc->num) { addsortrecord(mainrsrc,sortfile); increment_diagnostic=TRUE; } } } } } } } } } } } CLEAR_SCREEN_VIRTUAL(mainrsrc); if(tmprsrc!=NULL) update_diagnostic(tmprsrc,increment_diagnostic); ef=ADVSEQNRDsec(payddsv,SCRNvirtualSubData,mainrsrc); } if(tmprsrc!=NULL) { killwindow(tmprsrc); free_rsrc(tmprsrc); tmprsrc=NULL; } if(rs!=NULL) FreeRangeScreen(rs); if(SIZNRD(sortfile->fileno)) { OutputChecks(sortfile->fileno); } else { prterr("Error no Vendor Vouchers Selected for Check Printing."); } if(bankid1!=NULL) Rfree(bankid1); if(sortfile!=NULL) { CLSDBsort(sortfile); FreeDBsort(sortfile); } /* quitfunc(mainrsrc); */ }