: !/bin/sh cd /u/catcom/wb/ex ######################################################################## # T21BATCHNAME doex3web # T21BATCHDESC Web Billing Phase 2 # ALLOWBLANKDATES false # CUSTOMDESC Enter Parent ID (Div/ShipTo) (Blank for all) # CUSTOMDEF # T21BATCHVAR1DESC Process REST CDE folder (Blank for YES) # T21BATCHVAR1VALU # T21BATCHVAR2DESC PlatinumFileName/InvoiceNo/(Sundry if Parent set) # T21BATCHVAR2VALU # T21BATCHVAR3DESC Switch Board Call Cost # T21BATCHVAR3VALU 0.64 # T21BATCHVAR4DESC Voice Mail Call Cost # T21BATCHVAR4VALU 0.0 # T21BATCHVAR5DESC # T21BATCHVAR5VALU # T21BATCHENDARGS ######################################################################## SDATE=$1; EDATE=$2; STIME=$3; ETIME=$4 # get siteid if [ -n "$5" ]; then SITEID="$5" else SITEID="ALL" fi # custom param to specifiy onlU one parent if [ -n "$6" ]; then thisDIVID="$6" else thisDIVID="all" fi # args set by batchproc # process REST CE folder if [ -n "$T21BATCHVAR1VALU" ]; then restCDE="1" else restCDE="0" fi # only for this Platinum Batch file name or Batch for containing this invoiceno # if parent set and this is 6 or less chars then it is taken as a sundry number # if its 7-10 chars then it is taken as an invoice number # else it is taken as a Platinum Batch File Name if [ -n "$T21BATCHVAR2VALU" ]; then platinumBATCH="$T21BATCHVAR2VALU" else platinumBATCH="all" fi # switchboard call cost if [ -n "$T21BATCHVAR3VALU" ]; then switchboardcallcost="$T21BATCHVAR3VALU" else switchboardcallcost="0.64" fi # voicemail call cost if [ -n "$T21BATCHVAR4VALU" ]; then voicemailcallcost="$T21BATCHVAR4VALU" else voicemailcallcost="0.0" fi export switchboardcallcost voicemailcallcost ###################################################################### # Phase 2... generate web billing images / reports / csv # run wb3 extraction and convert into individual csv's under parent # as well as adding in image files and code and log MMYYYY=`SDATEtoMMYYYY $SDATE` #echo "MMYYYY = [$MMYYYY]" billperiod=`MMYYYYtobillperiod $MMYYYY _` #echo "$MMYYYY - billperiod = [$billperiod]" batchtag="${billperiod}_${platinumBATCH}_${thisDIVID}" ###################################################################### monthdir="topdat/${billperiod}" mkdir -p "$monthdir" 2>&1 targdir="${monthdir}/${platinumBATCH}_${thisDIVID}" logdir="$monthdir/log_${batchtag}" export monthdir targdir logdir if [ -d "$logdir" ]; then txtfile="/tmp/ex3_ERROR_WARNING_${batchtag}.rtf" echo "FATAL: Web Billing Phase 2 batch $batchtag dual run" >"$txtfile" emailex3tot /tmp/ex3 "$billperiod" "$thisDIVID" "$platinumBATCH" "" "PREFATAL" rm -f "$txtfile" exit 1 fi mkdir -p "$logdir" outfile="${logdir}/wb3_${batchtag}.out" (time wb3 "$SDATE" "$EDATE" "Nulls" "Nulls" "$SITEID" "$thisDIVID" "$restCDE" "$platinumBATCH" 2>&1) >"$outfile" ######################################################################## # archive log and work files # NOTE: if batch is invoiceno then wb3.awk creates a sym link for batchfilename if [ -d "${targdir}" -o -L "${targdir}" ]; then mv "${logdir}" "${targdir}" fi ######################################################################## # wb3.awk makes sym link if platinumBATCH is an invoice or div/sundry # if it is infact a sym link then this will remove it (rm -f "$targdir") 2>&1 >/dev/null ######################################################################## # all all then archive indata and topdat/billperiod if [ "$thisDIVID" = "all" -a "$platinumBATCH" = "all" ]; then ( # archive indata echo "" echo "Archive indata for $billperiod" time arcindata "$billperiod" 2>&1 # archive topdat echo "" echo "Archive topdat for $billperiod $thisDIVID $platinumBATCH" time arctopdat "$billperiod" 2>&1 ) 2>&1 >topdat/arcdat_log_${billperiod}.rtf fi ######################################################################## exit 0