示例#1
0
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);
}
示例#2
0
void PRcustompaperinfo(int pwidth, int plength, int xres, int yres)
{ 
#if 0 /*Disabling custom paper for now */
    int i;
    Sint32 n;
    PAPERINFO * np = (PAPERINFO *) paper_table_variable_resolution;
    CONST PAPERINFO * op = (CONST PAPERINFO *) system_paper_table;
    Boolean convert8 = ( xres % 300 );
#if defined(SUPPORT_EDGE2EDGE) || defined(RXPS_EDGE_TO_EDGE)
    Boolean   = OMGetCurrentBool(OMEDGETOEDGE,OMSYSTEM);
#ifdef PCL_CUSTOM_EDGE2EDGE
    Boolean enter_lang;
	if(customEdge2Edge){
		int njobid, ujobid;
    	enter_lang = OMGetCurrentEnum(OMREQPROCREASON, OMSYSTEM) ==
						REQPROCREASON_ENTERLANGUAGE;
		PrintSysGetjobid( &njobid, &ujobid);
		if(njobid == pre_njobid && ujobid == pre_ujobid)
			enter_lang = pre_enter_lang_custom;
		else {
			pre_njobid = njobid;
			pre_ujobid = ujobid;
		}
	}
#endif /* PCL_CUSTOM_EDGE2EDGE */
#endif /* SUPPORT_EDGE2EDGE || RXPS_EDGE_TO_EDGE */

#if defined(SUPPORT_EDGE2EDGE) || defined(RXPS_EDGE_TO_EDGE)
    if (cvtx == xres && cvty == yres && cvtw == pwidth && cvtl == plength && set_edge2edge_custom == edge2edge
#ifdef PCL_CUSTOM_EDGE2EDGE
					 && (!customEdge2Edge || enter_lang == pre_enter_lang_custom) 
#endif
       )
        return;
#else
    if (cvtx == xres && cvty == yres && cvtw == pwidth && cvtl == plength)
        return;
#endif /* SUPPORT_EDGE2EDGE || RXPS_EDGE_TO_EDGE */

	for (i = dimof(system_paper_table); i > 0; i--, np++, op++) {
        if (op->OMcode == PAPERSIZE_CUSTOM)
            break;
    }

    if (i == 0)
        return;

#if defined(SUPPORT_EDGE2EDGE) || defined(RXPS_EDGE_TO_EDGE)
    if ( edge2edge ) {
#ifdef PCL_CUSTOM_EDGE2EDGE
		if (customEdge2Edge && !enter_lang) {
			np->size.x = np->printable.x = np->rotnomsize.x = pwidth;
			np->nominal.x = pwidth - CONVERT_XONE(nomoffset);
			np->size.y = np->printable.y = np->nominal.y = plength;
			np->rotnomsize.y = plength - CONVERT_YONE(rotnomoffset);
			np->offset.x = np->offset.y = 0;
			CONVERT(nomoffset);
			if (pwidth >= plength) {
				CONVERT(rotnomoffset);
			} else {
				np->rotnomoffset.x = np->rotnomoffset.y = 0;
			}
	
			/*	The next 2 entries are NOT scaled. They get scaled when they used.
			 */
			np->HPnomoffset.x = np->nomoffset.x;
			np->HPnomoffset.y = np->HProtnomoffset.x = 0;
			np->HProtnomoffset.y = np->rotnomoffset.y;
		} else {
#endif /*PCL_CUSTOM_EDGE2EDGE*/   

#ifdef RP_CUSTOMPAPERSIZE
#if (defined(EMPCL5)||defined(EMPCLXL)) && (defined(EMPOSTSCRIPT)||defined(EMPDF))
	if ((TRUE == PrintSysIsPS()) || (TRUE == PrintSysIsPDF())){
#endif
    if(pwidth > plength){
        np->size.x = np->printable.x = np->nominal.x = np->rotnomsize.x = plength;
        np->size.y = np->printable.y = np->nominal.y = np->rotnomsize.y = pwidth;
    } else {
        np->size.x = np->printable.x = np->nominal.x = np->rotnomsize.x = pwidth;
        np->size.y = np->printable.y = np->nominal.y = np->rotnomsize.y = plength;
	}   
#if (defined(EMPCL5)||defined(EMPCLXL)) && (defined(EMPOSTSCRIPT)||defined(EMPDF))
    } else {		
        np->size.x = np->printable.x = np->nominal.x = np->rotnomsize.x = pwidth;
        np->size.y = np->printable.y = np->nominal.y = np->rotnomsize.y = plength;
	}   
#endif
#else    /* RP_CUSTOMPAPERSIZE */ 
        np->size.x = np->printable.x = np->nominal.x = np->rotnomsize.x = pwidth;
        np->size.y = np->printable.y = np->nominal.y = np->rotnomsize.y = plength;
#endif  /* RP_CUSTOMPAPERSIZE */ 
        np->offset.x = np->nomoffset.x = np->rotnomoffset.x = 0;
        np->offset.y = np->nomoffset.y = np->rotnomoffset.y = 0;

		/*  The next 2 entries are NOT scaled. They get scaled when they used.
         */
        np->HPnomoffset.x = np->HProtnomoffset.x = 0;
        np->HPnomoffset.y = np->HProtnomoffset.y = 0;
#ifdef PCL_CUSTOM_EDGE2EDGE
		}
#endif

    } else {
#endif

#ifdef RP_CUSTOMPAPERSIZE
#if (defined(EMPCL5)||defined(EMPCLXL)) && (defined(EMPOSTSCRIPT)||defined(EMPDF))
	if ((TRUE == PrintSysIsPS()) || (TRUE == PrintSysIsPDF())){
#endif
    np->printable.x = pwidth - 2 * CONVERT_XONE(offset);
    np->printable.y = plength - 2 * CONVERT_YONE(offset);
    if(pwidth > plength){
    np->size.x = plength;
    np->size.y = pwidth;
    np->nominal.x = plength - 2 * CONVERT_XONE(nomoffset);
    np->nominal.y = pwidth - 2 * CONVERT_YONE(nomoffset);
    np->rotnomsize.x = plength - 2 * CONVERT_XONE(rotnomoffset);
    np->rotnomsize.y = pwidth - 2 * CONVERT_YONE(rotnomoffset);
    } else {
    np->size.x = pwidth;
    np->size.y = plength;
    np->printable.x = pwidth - 2 * CONVERT_XONE(offset);
    np->printable.y = plength - 2 * CONVERT_YONE(offset);
    np->nominal.x = pwidth - 2 * CONVERT_XONE(nomoffset);
    np->nominal.y = plength - 2 * CONVERT_YONE(nomoffset);
    np->rotnomsize.x = pwidth - 2 * CONVERT_XONE(rotnomoffset);
    np->rotnomsize.y = plength - 2 * CONVERT_YONE(rotnomoffset);
    }
#if (defined(EMPCL5)||defined(EMPCLXL)) && (defined(EMPOSTSCRIPT)||defined(EMPDF))
    } else{
    np->size.x = pwidth;
    np->size.y = plength;
    np->printable.x = pwidth - 2 * CONVERT_XONE(offset);
    np->printable.y = plength - 2 * CONVERT_YONE(offset);
    np->nominal.x = pwidth - 2 * CONVERT_XONE(nomoffset);
    np->nominal.y = plength - 2 * CONVERT_YONE(nomoffset);
    np->rotnomsize.x = pwidth - 2 * CONVERT_XONE(rotnomoffset);
    np->rotnomsize.y = plength - 2 * CONVERT_YONE(rotnomoffset);
	}
#endif
#else   /* RP_CUSTOMPAPERSIZE */ 
	
    np->size.x = pwidth;
    np->size.y = plength;
    np->printable.x = pwidth - 2 * CONVERT_XONE(offset);
    np->printable.y = plength - 2 * CONVERT_YONE(offset);
    np->nominal.x = pwidth - 2 * CONVERT_XONE(nomoffset);
    np->nominal.y = plength - 2 * CONVERT_YONE(nomoffset);
    np->rotnomsize.x = pwidth - 2 * CONVERT_XONE(rotnomoffset);
    np->rotnomsize.y = plength - 2 * CONVERT_YONE(rotnomoffset);
#endif /* RP_CUSTOMPAPERSIZE */ 
    
    CONVERT(offset);
    CONVERT(nomoffset);
    CONVERT(rotnomoffset);
    
    /*  The next 2 entries are NOT scaled. They get scaled when they used.
     */
    FIELDCOPY(HPnomoffset);
    FIELDCOPY(HProtnomoffset);

#if defined(SUPPORT_EDGE2EDGE) || defined(RXPS_EDGE_TO_EDGE)
    }
#endif

#ifdef PCL5_CUSTOMSIZE_COMMAND
#if (defined(EMPCL5)||defined(EMPCLXL)) && (defined(EMPOSTSCRIPT)||defined(EMPDF))
	if( (TRUE == PrintSysIsPCL()) || (TRUE == PrintSysIsPCLXL())){
#endif
    if (np->printable.x <= 0)
        np->printable.x = NBITS;
    if (np->nominal.x <= 0)
        np->nominal.x = NBITS;
    if (np->rotnomsize.x <= 0)
        np->rotnomsize.x = NBITS;
    if (np->printable.y <= 0)
        np->printable.y = 1;
    if (np->nominal.y <= 0)
        np->nominal.y = 1;
    if (np->rotnomsize.y <= 0)
        np->rotnomsize.y = 1;
#if (defined(EMPCL5)||defined(EMPCLXL)) && (defined(EMPOSTSCRIPT)||defined(EMPDF))
	}
#endif
#endif /* PCL5_CUSTOMSIZE_COMMAND */

    np->OMcode = op->OMcode;
    np->PCLpaperID = op->PCLpaperID;
    np->XLpaperID = op->XLpaperID;
    np->envelope = op->envelope;
    np->noduplex = op->noduplex;

#ifdef EMPOSTSCRIPT /* RP_CUSTOMPAPERSIZE */
#if (defined(EMPCL5)||defined(EMPCLXL)) && (defined(EMPOSTSCRIPT)||defined(EMPDF))
	if ((TRUE == PrintSysIsPS()) || (TRUE == PrintSysIsPDF())){
#endif
#ifdef RP_CUSTOMPAPERSIZE
      if(pwidth > plength){
	np->PS_PageSize.x = (int)(((float)plength/xres)*72);  /* dot -> pt */
	np->PS_PageSize.y = (int)(((float)pwidth/yres)*72); /* dot -> pt */
      	}else{
	np->PS_PageSize.x = (int)(((float)pwidth/xres)*72);  /* dot -> pt */
	np->PS_PageSize.y = (int)(((float)plength/yres)*72); /* dot -> pt */
	  	}
#endif /* RP_CUSTOMPAPERSIZE */ 
#if defined(SUPPORT_EDGE2EDGE) || defined(RXPS_EDGE_TO_EDGE)
    if ( edge2edge ) {
		np->PS_printable.x = pwidth;
		np->PS_printable.y = plength;
		np->PS_margins.x = 0;
		np->PS_margins.y = 0;
    } else {
#endif /* SUPPORT_EDGE2EDGE || RXPS_EDGE_TO_EDGE */
		np->PS_printable.x = pwidth - 2 * CONVERT_XONE(PS_margins);
		np->PS_printable.y = plength - 2 * CONVERT_YONE(PS_margins);
		CONVERT(PS_margins);
#if defined(SUPPORT_EDGE2EDGE) || defined(RXPS_EDGE_TO_EDGE)
    }
#endif
#if (defined(EMPCL5)||defined(EMPCLXL)) && (defined(EMPOSTSCRIPT)||defined(EMPDF))
	}
#endif
#endif /* EMPOSTSCRIPT (RP_CUSTOMPAPERSIZE) */

    np->resolution.x = xres;
    np->resolution.y = yres;

#ifdef GPS_REJECTION
	np->Direction = op->Direction;
	np->Duplex = op->Duplex;
	np->Staple = op->Staple;
	np->RotateCollate = op->RotateCollate;
	np->StandardTray = op->StandardTray;
	np->ShiftBin = op->ShiftBin;
	np->MailBoxBin = op->MailBoxBin;
#endif /* GPS_REJECTION */

    cvtx = xres;
    cvty = yres;
    cvtw = pwidth;
    cvtl = plength;
#if defined(SUPPORT_EDGE2EDGE) || defined(RXPS_EDGE_TO_EDGE)
    set_edge2edge_custom = edge2edge;
#ifdef PCL_CUSTOM_EDGE2EDGE
	if(customEdge2Edge){
		pre_enter_lang_custom = enter_lang;
	}
#endif
#endif /* SUPPORT_EDGE2EDGE || RXPS_EDGE_TO_EDGE */
#endif /*Cutompaper disabled for now */
}