home *** CD-ROM | disk | FTP | other *** search
- #include <sybfront.h>
- #include <sybdb.h>
- #include <sybfrs.h>
-
- #if MSDOS
- # include <stdlib.h>
- # include "aforms.h"
- #endif /* MSDOS */
-
- #define BUFSIZE 100
-
- /*
- ** ADISC - Additional Discount
- **
- ** Adjust the total discount using the newly entered "additional
- ** discount". This procedure is triggered by additional discount
- ** field post-processing.
- */
- adisc(context, argarray)
- FRSCONTEXT *context;
- POINTER argarray[];
- {
-
- #if !MSDOS && !OS2
- extern double atof();
- #endif /* !MSDOS && !OS2 */
-
- FORM *form;
- DATADSC *data;
- DBFLT8 delta;
- DBFLT8 discount;
- char buf[BUFSIZE];
-
- /* Get the form */
- form = fscurform(context);
-
- /* Get the difference between the new additional discount
- ** and the old additional discount.
- */
- data = fsdcurddc(context);
- delta = atof(fsdgetval(data)) - atof(fsdgetprvval(data));
-
- /* Get the current total discount */
- fsfreadval(form, "totpercent", -1, NULL, &discount, NULL);
- discount += delta;
-
- /* Update the form with the new total discount */
- fsfwriteval(form, "totpercent", -1, NULL, -1, SSOFF,
- &discount, buf, -1, FALSE);
-
-
- /* Call a routine to compute and display the total cost. */
- clcst(form, "quantity", "totpercent", "price", "totalcost");
-
- /* All done! */
- return;
- }
-