New isdnrep option -m [*|/]number. It multiplies or divide the cost of
each call by the given number. `-m/1.16' for example displays the costs without the German `Umsatzsteuer'.
This commit is contained in:
parent
e2ed7d9d08
commit
fd406e65da
|
@ -1,3 +1,10 @@
|
|||
2004-07-25 Tobias Becker <tobiasb@isdn4linux.de>
|
||||
|
||||
* rep_main.c (parse_options): New option `-m', multiplies or divides
|
||||
connection costs before displaying
|
||||
* isdnrep.h (modcost): New global variable for `-m' option.
|
||||
* isdnrep.c (print_header, set_caller_infos): Apply `-m' option.
|
||||
|
||||
2004-07-24 Tobias Becker <tobiasb@isdn4linux.de>
|
||||
|
||||
* rep_main.c (parse_options): New option `-x', selects calls by hour
|
||||
|
|
|
@ -241,6 +241,12 @@ B
|
|||
Like b but allow all providers, not only the booked.
|
||||
.RE
|
||||
|
||||
.TP
|
||||
\fB\-m\fR[\fB*\fR|\fB/\fR]\fInumber\fB modify call costs\fR
|
||||
Multiply (*) or divide (/) the stored or recalculated call costs
|
||||
by number before displaying them. If neither * nor / is given,
|
||||
multiply.
|
||||
|
||||
.TP
|
||||
.B \-wX WWW
|
||||
isdnrep can give its output in HTML format; this is switched on with
|
||||
|
|
|
@ -24,6 +24,14 @@
|
|||
*
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.100 2004/07/24 17:58:06 tobiasb
|
||||
* New isdnrep options: `-L:' controls the displayed call summaries in the
|
||||
* report footer. `-x' displays only call selected or not deselected by
|
||||
* hour or type of day -- may be useful in conjunction with `-r'.
|
||||
*
|
||||
* Activated new configuration file entry `REPOPTIONS' for isdnrep default
|
||||
* options. This options can be disabled by `-c' on the command line.
|
||||
*
|
||||
* Revision 1.99 2004/02/25 12:09:08 paul
|
||||
* There was no bounds checking on unknownzones, which is only useds
|
||||
* if DEBUG is defined. This caused a SIGSEGV with many unknown numbers
|
||||
|
@ -2192,6 +2200,11 @@ static int print_header(int lday)
|
|||
}
|
||||
print_line2(F_TEXT_LINE, "%s", s);
|
||||
}
|
||||
|
||||
/* TODO: consistent terminology. fees vs. costs (tobiasb|200407) */
|
||||
if (modcost.mode)
|
||||
print_line2(F_TEXT_LINE, "All displayed costs have been %s by %s.",
|
||||
modcost.mode == 2 ? "divided" : "multiplied", modcost.numstr);
|
||||
|
||||
}
|
||||
else
|
||||
|
@ -2716,6 +2729,14 @@ static int set_caller_infos(one_call *cur_call, char *string, time_t from)
|
|||
*/
|
||||
repair(cur_call);
|
||||
|
||||
if (cur_call->pay != 0.0 && modcost.mode)
|
||||
{
|
||||
if (modcost.mode == 1)
|
||||
cur_call->pay *= modcost.number;
|
||||
else if (modcost.mode == 2)
|
||||
cur_call->pay /= modcost.number;
|
||||
}
|
||||
|
||||
return(rc);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,14 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.23 2004/07/24 17:58:06 tobiasb
|
||||
* New isdnrep options: `-L:' controls the displayed call summaries in the
|
||||
* report footer. `-x' displays only call selected or not deselected by
|
||||
* hour or type of day -- may be useful in conjunction with `-r'.
|
||||
*
|
||||
* Activated new configuration file entry `REPOPTIONS' for isdnrep default
|
||||
* options. This options can be disabled by `-c' on the command line.
|
||||
*
|
||||
* Revision 1.22 2003/10/29 17:41:35 tobiasb
|
||||
* isdnlog-4.67:
|
||||
* - Enhancements for isdnrep:
|
||||
|
@ -210,6 +218,14 @@ typedef struct {
|
|||
char *input; /* input from command line after -r[vp] */
|
||||
} RECALC;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
int mode; /* 0 no action, 1 multiply, 2 divide */
|
||||
char *numstr; /* number as string, part of given option */
|
||||
double number; /* number for multiplication or division */
|
||||
} MODCOST;
|
||||
|
||||
/*****************************************************************************/
|
||||
/* isdnrep.c defines _REP_FUNC_C_, rep_main.c defines _ISDNREP_C_, ... */
|
||||
#ifdef _REP_FUNC_C_
|
||||
|
@ -262,6 +278,7 @@ _EXTERN int preselect _SET_33;
|
|||
#endif
|
||||
_EXTERN int summary _SET_0;
|
||||
_EXTERN RECALC recalc; /* initiation done in main */
|
||||
_EXTERN MODCOST modcost; /* initiation done in main */
|
||||
_EXTERN int sel_sums[3] _SET_ARRAY_0;
|
||||
_EXTERN bitfield days[2] _SET_ARRAY_0;
|
||||
_EXTERN bitfield hours[2] _SET_ARRAY_0;
|
||||
|
|
|
@ -20,6 +20,14 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.18 2004/07/24 17:58:06 tobiasb
|
||||
* New isdnrep options: `-L:' controls the displayed call summaries in the
|
||||
* report footer. `-x' displays only call selected or not deselected by
|
||||
* hour or type of day -- may be useful in conjunction with `-r'.
|
||||
*
|
||||
* Activated new configuration file entry `REPOPTIONS' for isdnrep default
|
||||
* options. This options can be disabled by `-c' on the command line.
|
||||
*
|
||||
* Revision 1.17 2003/10/29 17:41:35 tobiasb
|
||||
* isdnlog-4.67:
|
||||
* - Enhancements for isdnrep:
|
||||
|
@ -298,7 +306,7 @@ static char fnbuff[512] = "";
|
|||
static char usage[] = "%s: usage: %s [ -%s ]\n";
|
||||
static char wrongdate[] = "unknown date: %s\n";
|
||||
static char wrongxopt[] = "error in -x option starting at: %s\n";
|
||||
static char options[] = "abcd:f:hinop:r:s:t:uvw:x:EF:L:M:NR:SV";
|
||||
static char options[] = "abcd:f:him:nop:r:s:t:uvw:x:EF:L:M:NR:SV";
|
||||
static char *linefmt = "";
|
||||
static char *htmlreq = NULL;
|
||||
static char *phonenumberarg = NULL;
|
||||
|
@ -318,6 +326,7 @@ int main(int argc, char *argv[], char *envp[])
|
|||
|
||||
recalc.mode = '\0'; recalc.prefix = UNKNOWN; recalc.input = NULL;
|
||||
recalc.count = recalc.unknown = recalc.cheaper = 0;
|
||||
modcost.mode = 0;
|
||||
select_summaries(sel_sums, NULL); /* default: all summaries */
|
||||
|
||||
/* we don't need this at the moment:
|
||||
|
@ -332,6 +341,8 @@ int main(int argc, char *argv[], char *envp[])
|
|||
* set_msnlist after readconfig.
|
||||
*/
|
||||
|
||||
/* TODO: parse_options may print to stdout regardless a missing
|
||||
* Content-Type header. (tobiasb|200407) */
|
||||
if ((c=parse_options(argc, argv, myname) > 0))
|
||||
return c;
|
||||
|
||||
|
@ -524,6 +535,26 @@ static int parse_options(int argc, char *argv[], char *myname)
|
|||
case 'c' : do_defopts = 0;
|
||||
break;
|
||||
|
||||
case 'm' : modcost.mode = (*optarg =='/') ? 2 : 1;
|
||||
modcost.numstr = strdup(optarg);
|
||||
if (*optarg == '*' || *optarg == '/')
|
||||
modcost.numstr++;
|
||||
ptr = NULL;
|
||||
modcost.number = strtod(modcost.numstr, &ptr);
|
||||
if (modcost.numstr == ptr)
|
||||
{
|
||||
printf("no number in -m option: %s\n", modcost.numstr);
|
||||
return 1;
|
||||
}
|
||||
if (modcost.mode == 2 && modcost.number == 0.0)
|
||||
{
|
||||
printf("division by 0 as requested in -m option not allowed.\n");
|
||||
return 1;
|
||||
}
|
||||
if (ptr && *ptr)
|
||||
*ptr = 0;
|
||||
break;
|
||||
|
||||
case '?' : printf(usage, argv[0], argv[0], options);
|
||||
return(1);
|
||||
} /* switch */
|
||||
|
|
Loading…
Reference in New Issue