2 # An script to generate a csv.
4 GET
="/home/the00z/neuroservices/tarificador/get"
5 TMP
=`getopt -o h --long help -- "$@"`
25 echo "I need an argument at least to work"
31 eval 'time' "'$GET'" > "$EDIFICIO.csv" <<END
33 date(llamada.start), time(llamada.start),'','1.49', llamada.destino,
34 duration,concat('0',edificio_extension.edificio_id,extension.numero),'',
37 edificio, edificio_extension, extension , extension_llamada , llamada
39 edificio.id='${EDIFICIO}' and
40 edificio.id<=>edificio_extension.edificio_id and
41 edificio_extension.extension_id<=>extension.id and
42 extension.id<=>extension_llamada.extension_id and
43 extension_llamada.llamada_id<=>llamada.id
44 and llamada.d_context regexp '^(cs-|in|celu)'
45 and llamada.cuenta != ''
46 and llamada.disposition regexp '^answered'
47 and llamada.last_app regexp 'dial'
48 and llamada.d_context not regexp 'interno'
49 and llamada.bill_sec != '0'
50 and llamada.destino regexp '^9'
51 and extension.numero !=''
56 if [ "$?" != "0" ]; then exit "$?";fi