/* * Auto Payment Calculator V1.0.1beta * Copyright (C) 1997 Eric A. Griff * * An Auto Payment Calculator. * * *Portions of this code use xforms-0.86 which is copyrighted as * * Copyright (C) 1996-1997 by T.C. Zhao and Mark Overmars. ALL RIGHTS * RESERVED * */ #include "forms.h" #include "apc.h" #include "mathfun.h" extern FD_pymain *fd_pymain; /* callbacks for form pymain */ void Calculate_Call(FL_OBJECT *ob, long data) { /* fill-in code for callback */ char buf[256]; double pmnt; if(!famount || !fterm || !frate) return; #ifdef FOUR sprintf(buf,"%d Monthly payments of $%3.4f\0",fterm,mpmt(famount,frate,fterm)); #else sprintf(buf,"%d Monthly payments of $%3.2f\0",fterm,mpmt(famount,frate,fterm)); #endif fl_hide_object(fd_pymain->ResultM); fl_set_object_label(fd_pymain->ResultM,buf); XFlush(fl_get_display()); fl_show_object(fd_pymain->ResultM); pmnt=wpmt(famount,frate,fterm); #ifdef FOUR sprintf(buf,"%d Weekly payments of $%3.4f\0",fweeks,pmnt); #else sprintf(buf,"%d Weekly payments of $%3.2f\0",fweeks,pmnt); #endif fl_hide_object(fd_pymain->ResultW); fl_set_object_label(fd_pymain->ResultW,buf); XFlush(fl_get_display()); fl_show_object(fd_pymain->ResultW); #ifdef DEBBUGGING printf("mpmt=%3.2f wpmt=%3.2f\n",mpmt(famount,frate,fterm),wpmt(famount,frate,fterm)); #endif }