Ejemplo n.º 1
0
function timecard_html($empfullname, $local_timestamp_in_week)
{
    // Return html of employee's timecard.
    global $show_display_name, $one_week;
    // SQL search parameters for one work week.
    $begin_local_timestamp = work_week_begin($local_timestamp_in_week);
    $end_local_timestamp = $begin_local_timestamp + $one_week;
    // Define helper functions for printing timecard header, footer, and for printing every row.
    function print_header($tc)
    {
        // Print timecard html header.
        global $overtime_week_limit, $timecard_display_running_total;
        $overtime_col = $overtime_week_limit > 0 ? "\n    <th align=\"center\" class=\"ovt\" title=\"Overtime hours\">OT</th>" : '';
        $total_col = $timecard_display_running_total == "yes" ? "\n    <th align=\"center\" class=\"total\" title=\"Running total of regular work hours and overtime to date.\">Total</th>" : '';
        print <<<End_Of_HTML

<table class="misc_items timecard_list" border="0" cellpadding="2" cellspacing="0" style="margin:0 auto;">
  <thead>
  <tr>
    <th align="left">In/Out</th>
    <th align="center">Time</th>
    <th align="center">Date</th>
    <th align="center" class="hrs" title="Regular work hours.">Hrs</th>{$overtime_col}{$total_col}
    <th align="left" class="notes">Notes</th>
  </tr>
  </thead>
  <tbody>
End_Of_HTML;
    }
    function print_row($tc)
    {
        // Configuration variables.
        global $timefmt, $datefmt;
        global $overtime_week_limit, $timecard_list_punch_outs, $timecard_display_hours_minutes;
        global $timecard_hours_include_overtime, $timecard_display_running_total;
        static $print_count = 0;
        if ($tc->in_or_out == 1 || $timecard_list_punch_outs == 'yes') {
            $h_color = htmlentities($tc->row['color']);
            $h_inout = htmlentities($tc->row['inout']);
            $h_time = date($timefmt, $tc->start_time);
            $h_date = date($datefmt, $tc->start_time);
            if ($timecard_display_hours_minutes == "yes") {
                $h_hours = hrs_min($timecard_hours_include_overtime == "yes" ? $tc->hours + $tc->overtime : $tc->hours);
                $h_overtime = hrs_min($tc->overtime);
                $h_total = hrs_min($tc->week_hours + $tc->overtime_hours);
            } else {
                $h_hours = sprintf("%01.02f", $timecard_hours_include_overtime == "yes" ? $tc->hours + $tc->overtime : $tc->hours);
                $h_overtime = sprintf("%01.02f", $tc->overtime);
                $h_total = sprintf("%01.02f", $tc->week_hours + $tc->overtime_hours);
            }
            $h_notes = htmlentities($tc->row['notes']);
            if ($tc->in_or_out != 1) {
                // Don't display hours on "out" records.
                $h_hours = $h_overtime = $h_total = '';
            }
            $row_class = ++$print_count % 2 ? 'odd' : 'even';
            $overtime_col = $overtime_week_limit > 0 ? "\n    <td align=\"right\" class=\"ovt\">{$h_overtime}</td>" : '';
            $total_col = $timecard_display_running_total == "yes" ? "\n    <td align=\"right\" class=\"total\">{$h_total}</td>" : '';
            print <<<End_Of_HTML

  <tr class="display_row {$row_class}">
    <td align="left" style="color:{$h_color}">{$h_inout}</td>
    <td align="right">{$h_time}</td>
    <td align="right">{$h_date}</td>
    <td align="right" class="hrs">{$h_hours}</td>{$overtime_col}{$total_col}
    <td align="left" class="notes">{$h_notes}</td>
  </tr>
End_Of_HTML;
        }
    }
    function print_footer($tc)
    {
        global $timecard_display_running_total, $timecard_hours_include_overtime;
        global $timecard_display_hours_minutes, $overtime_week_limit;
        // Set flag to print paragraph of totals if they're not already obvious.
        $print_totals = $timecard_display_running_total == "yes" || $timecard_hours_include_overtime != "yes" ? true : false;
        $h_total_hours = sprintf("%01.02f", $tc->week_hours + $tc->overtime_hours);
        $h_totals = $print_totals ? "\n<p>Total for week: " . hrs_min($tc->week_hours + $tc->overtime_hours) . " ({$h_total_hours} hours)</p>" : '';
        $h_ovt_total_hours = sprintf("%01.02f", $tc->overtime_hours);
        $h_overtime_totals = $print_totals && $tc->overtime_hours > 0 ? "\n<p>Total overtime: " . hrs_min($tc->overtime_hours) . " ({$h_ovt_total_hours} hours)</p>" : '';
        $h_day_total_hours = sprintf("%01.02f", $tc->today_hours);
        $h_today_hours = $tc->today_hours !== null ? "<p>Total today: " . hrs_min($tc->today_hours) . " ({$h_day_total_hours} hours)</p>" : '';
        if ($timecard_display_running_total != "yes") {
            // Print row of totals
            $total_hours = $timecard_hours_include_overtime == "yes" ? $tc->week_hours + $tc->overtime_hours : $tc->week_hours;
            $h_hours = $timecard_display_hours_minutes == "yes" ? hrs_min($total_hours) : $h_total_hours;
            $overtime_col = $overtime_week_limit > 0 ? "\n    <td align=\"right\" class=\"ovt\">" . ($timecard_display_hours_minutes == "yes" ? hrs_min($tc->overtime_hours) : $h_ovt_total_hours) . "</td>" : '';
            $total_col = $timecard_display_running_total == "yes" ? "\n    <td align=\"right\" class=\"total\">" . ($timecard_display_hours_minutes == "yes" ? hrs_min($tc->week_hours + $tc->overtime_hours) : $h_total_hours) . "</td>" : '';
            print <<<End_Of_HTML
  <tr class="total_row">
    <td align="left"></td>
    <td align="right"></td>
    <td align="right"></td>
    <td align="right" class="hrs">{$h_hours}</td>{$overtime_col}{$total_col}
    <td align="left" class="notes"></td>
  </tr>
End_Of_HTML;
        }
        print <<<End_Of_HTML
  </tbody>
</table>
End_Of_HTML;
        if ($timecard_display_running_total == "yes" || $timecard_hours_include_overtime != "yes" || $h_today_hours) {
            // Add totals text if totals are not already displayed or if summing the hours column is confusing.
            print <<<End_Of_HTML

<div class="totals">
{$h_today_hours}{$h_totals}{$h_overtime_totals}
</div>

End_Of_HTML;
        }
    }
    // End of helper function definitions.
    // Print timecard page header.
    $h_name_header = htmlentities($show_display_name == 'yes' ? get_employee_name($empfullname) : $empfullname);
    $begin_date = date('l F j, Y', $begin_local_timestamp);
    print <<<End_Of_HTML

<div class="timecard">
<h2>Timecard</h2>
<h3>{$h_name_header}</h3>
<h4>Week beginning {$begin_date}</h4>
End_Of_HTML;
    // Print timecard.
    $tc = new Timecard($empfullname, $begin_local_timestamp, $end_local_timestamp);
    list($row_count, $total_hours, $overtime_hours, $today_hours) = $tc->walk(print_header, print_row, print_footer);
    if ($row_count <= 0) {
        print error_msg("No records were found.");
    }
    // Print timecard page footer.
    print <<<End_Of_HTML
</div> <!-- timecard -->

End_Of_HTML;
}
Ejemplo n.º 2
0
 public function export()
 {
     $map = array();
     $voList = array();
     $map = $this->searchMap();
     $map['post_goods.isCheckOut'] = array('eq', '1');
     $model = D('OrderBase');
     if (!empty($model)) {
         $voList = $this->exportList($model, $map);
     }
     if ($voList) {
         $FileName = date('Y-m-d') . "出库单打印数据.xls";
         $FileName = iconv("UTF-8", "GBK", $FileName);
         header("Content-Type: application/vnd.ms-execl");
         header("Content-Disposition: attachment; filename= {$FileName}");
         header("Pragma: no-cache");
         header("Expires: 0");
         /*first line*/
         $HeaderStr = "期数" . "\t";
         $HeaderStr .= "月份" . "\t";
         $HeaderStr .= "收货人" . "\t";
         $HeaderStr .= "省份" . "\t";
         $HeaderStr .= "城市" . "\t";
         $HeaderStr .= "单位" . "\t";
         $HeaderStr .= "班级" . "\t";
         $HeaderStr .= "电话" . "\t";
         $HeaderStr .= "地址" . "\t";
         $HeaderStr .= "报刊名称" . "\t";
         $HeaderStr .= "份数" . "\t";
         $HeaderStr .= "发行人" . "\t";
         $HeaderStr .= "发货方式" . "\t";
         $HeaderStr .= "是否打印出库单" . "\t";
         $HeaderStr .= "出库单号" . "\t\n";
         $ContentStr = '';
         /*start of second line*/
         foreach ($voList as $vo) {
             $ContentStr .= $vo['termName'] . "\t";
             $ContentStr .= $vo['termMonth'] . "\t";
             $ContentStr .= $vo['recPeople'] . "\t";
             $ContentStr .= get_province_name($vo['provinceID']) . "\t";
             $ContentStr .= $vo['cityName'] . "\t";
             $ContentStr .= get_custom_unit_name($vo['schoolID']) . "\t";
             $ContentStr .= $vo['class'] . "\t";
             $ContentStr .= $vo['recTelphone'] . "\t";
             $ContentStr .= $vo['recAddress'] . "\t";
             $ContentStr .= $vo['magazineName'] . "\t";
             $ContentStr .= $vo['sendNum'] . "\t";
             $ContentStr .= get_employee_name($vo['postPeople']) . "\t";
             $ContentStr .= get_send_goods_type_name($vo['sendGoodsTypeID']) . "\t";
             if ($vo['isPrintCheckOut']) {
                 $ContentStr .= "是\t";
             } else {
                 $ContentStr .= "否\t";
             }
             $ContentStr .= $vo['checkOutNum'] . "\t\n";
         }
         $HeaderStr = iconv("UTF-8", "GBK", $HeaderStr);
         $ContentStr = iconv("UTF-8", "GBK", $ContentStr);
         echo $HeaderStr . $ContentStr;
         exit;
     } else {
         $this->error('没有数据!');
     }
 }
Ejemplo n.º 3
0
if (!$empfullname) {
    $empfullname = $emp;
}
// from url or form entry
// Lookup valid employee
if ($empfullname) {
    $empfullname = lookup_employee($empfullname);
    if (!$empfullname) {
        $error_msg .= "Name was not recognized. Please re-enter your name.\n";
        unset($_SESSION['authenticated']);
    }
}
if ($empfullname) {
    $u_empfullname = rawurlencode($empfullname);
    $h_empfullname = htmlentities($empfullname);
    $h_name_header = $show_display_name == 'yes' ? htmlentities(get_employee_name($empfullname)) : $h_empfullname;
}
// Authorize employee
$authorized = isset($_SESSION['authenticated']) ? $_SESSION['authenticated'] == $empfullname : false;
if (!$authorized) {
    $_SESSION['login_title'] = "";
    $_SESSION['login_error_msg'] = $error_msg;
    $_SESSION['login_return_url'] = $_SERVER['REQUEST_URI'];
    exit_next("login.php" . ($u_empfullname ? "?emp={$u_empfullname}" : ''));
}
////////////////////////////////////////
if ($authorized && isset($_POST['inout'])) {
    // Post employee time.
    $inout = $_POST['inout'];
    $q_inout = mysql_real_escape_string($inout);
    $h_inout = htmlentities($inout);
Ejemplo n.º 4
0
$emp = isset($_GET['emp']) ? $_GET['emp'] : null;
$empfullname = isset($_POST['empfullname']) ? $_POST['empfullname'] : null;
$old_password = isset($_POST['old_password']) ? $_POST['old_password'] : null;
$new_password = isset($_POST['new_password']) ? $_POST['new_password'] : null;
$confirm_password = isset($_POST['confirm_password']) ? $_POST['confirm_password'] : null;
if (!$empfullname) {
    $empfullname = $emp;
}
// from url or form entry
if (!$empfullname) {
    die(error_msg("Unrecognized employee."));
}
// no employee specified
$h_empfullname = htmlentities($empfullname);
$u_empfullname = rawurlencode($empfullname);
$displayname = get_employee_name($empfullname);
$h_displayname = htmlentities($displayname);
$name_header = $show_display_name == 'yes' ? $h_displayname : $h_empfullname;
// Process form submission.
if ($old_password) {
    // Validate password
    if (is_valid_password($empfullname, $old_password)) {
        // Check if new password is same as confirm password entry
        if ($new_password === $confirm_password) {
            // Save password.
            if (save_employee_password($empfullname, $new_password)) {
                $_SESSION['authenticated'] = $empfullname;
                exit_next("entry.ajax.php?emp={$u_empfullname}");
            } else {
                print error_msg("Cannot save your new password. " . mysql_error());
            }
Ejemplo n.º 5
0
 function export()
 {
     $map = $this->_search();
     if (method_exists($this, '_filter')) {
         $this->_filter($map);
     }
     $EmployeeNewspaper = D('EmployeeNewspaper');
     $EmployeeId = get_employeeid($_SESSION[C('USER_AUTH_KEY')]);
     $MagazineList = $EmployeeNewspaper->getEmployeeNespapers($EmployeeId);
     $MagazinePostCodes;
     foreach ($MagazineList as $vo) {
         $MagazinePostCodes .= $vo['postCode'] . ',';
     }
     $MagazinePostCodes = substr($MagazinePostCodes, 0, strlen($MagazinePostCodes) - 1);
     if ($MagazinePostCodes) {
         $map['postCode'] = array('in', $MagazinePostCodes);
     }
     if (method_exists($this, '_filter')) {
         $this->_filter($map);
     }
     $model = D('OrderBase');
     if (!empty($model)) {
         $count = $model->where($map)->count('id');
         if ($count > 0) {
             import("ORG.Util.Page");
             $EmployeeId = get_employeeid($_SESSION[C('USER_AUTH_KEY')]);
             $EmployeeNewspaper = D('EmployeeNewspaper');
             $MagazineList = $EmployeeNewspaper->getEmployeeNespapers($EmployeeId);
             $MagazinePostCodes;
             foreach ($MagazineList as $vo) {
                 $MagazinePostCodes .= $vo['postCode'] . ',';
             }
             $MagazinePostCodes = substr($MagazinePostCodes, 0, strlen($MagazinePostCodes) - 1);
             if ($MagazinePostCodes) {
                 $map['postCode'] = array('in', $MagazinePostCodes);
             }
             //创建分页对象
             if (!empty($_REQUEST['listRows'])) {
                 $listRows = $_REQUEST['listRows'];
             } else {
                 $listRows = '';
             }
             $p = new Page($count, $listRows);
             //分页查询数据
             $order = 'insertTime desc, employeeID desc, recPeople desc, postCode desc ';
             $voList = $model->where($map)->order($order)->select();
             $FileName = date('Y-m-d') . "订单审核数据.xls";
             $FileName = iconv("UTF-8", "GBK", $FileName);
             header("Content-Type: application/vnd.ms-execl");
             header("Content-Disposition: attachment; filename= {$FileName}");
             header("Pragma: no-cache");
             header("Expires: 0");
             /*first line*/
             $HeaderStr = "日期" . "\t";
             $HeaderStr .= "批次" . "\t";
             $HeaderStr .= "业务经理" . "\t";
             $HeaderStr .= "客户名称" . "\t";
             $HeaderStr .= "收货人" . "\t";
             $HeaderStr .= "省份" . "\t";
             $HeaderStr .= "城市" . "\t";
             $HeaderStr .= "单位" . "\t";
             $HeaderStr .= "班级" . "\t";
             $HeaderStr .= "手机" . "\t";
             $HeaderStr .= "传真" . "\t";
             $HeaderStr .= "备用电话" . "\t";
             $HeaderStr .= "地址" . "\t";
             $HeaderStr .= "邮编" . "\t";
             $HeaderStr .= "报刊" . "\t";
             $HeaderStr .= "份数" . "\t";
             $HeaderStr .= "起月" . "\t";
             $HeaderStr .= "止月" . "\t";
             $HeaderStr .= "磁带数" . "\t";
             $HeaderStr .= "答案数" . "\t";
             $HeaderStr .= "是否薄弱县" . "\t";
             $HeaderStr .= "发货类型" . "\t";
             $HeaderStr .= "发货方式" . "\t";
             $HeaderStr .= "发货周期" . "\t";
             $HeaderStr .= "备注" . "\t";
             $HeaderStr .= "付款人" . "\t";
             $HeaderStr .= "保存时间" . "\t";
             $HeaderStr .= "提交时间" . "\t";
             $HeaderStr .= "是否审核" . "\t\n";
             $ContentStr = '';
             /*start of second line*/
             foreach ($voList as $vo) {
                 $ContentStr .= date('Y-m-d', $vo['orderTime']) . "\t";
                 $ContentStr .= $vo['batch'] . "\t";
                 $ContentStr .= get_employee_name($vo['employeeID']) . "\t";
                 $ContentStr .= get_custom_name($vo['customID']) . "\t";
                 $ContentStr .= $vo['recPeople'] . "\t";
                 $ContentStr .= get_province_name($vo['provinceID']) . "\t";
                 $ContentStr .= $vo['cityName'] . "\t";
                 $ContentStr .= get_custom_unit_name($vo['schoolID']) . "\t";
                 $ContentStr .= $vo['class'] . "\t";
                 $ContentStr .= $vo['recTelphone'] . "\t";
                 $ContentStr .= $vo['recFax'] . "\t";
                 $ContentStr .= $vo['recSpareTel'] . "\t";
                 $ContentStr .= $vo['recAddress'] . "\t";
                 $ContentStr .= $vo['zipCode'] . "\t";
                 $ContentStr .= get_magazine_name($vo['postCode']) . "\t";
                 $ContentStr .= $vo['orderNum'] . "\t";
                 $ContentStr .= $vo['beginOrderDate'] . "\t";
                 $ContentStr .= $vo['endOrderDate'] . "\t";
                 $ContentStr .= $vo['tapeNum'] . "\t";
                 $ContentStr .= $vo['answerNum'] . "\t";
                 $ContentStr .= $vo['weakCity'] . "\t";
                 $ContentStr .= get_send_goods_sort_name($vo['sendGoodsSortID']) . "\t";
                 $ContentStr .= get_send_goods_type_name($vo['sendGoodsTypeID']) . "\t";
                 $ContentStr .= get_send_order_cyle_name($vo['sendCyleID']) . "\t";
                 $ContentStr .= $vo['memo'] . "\t";
                 $ContentStr .= $vo['payPerson'] . "\t";
                 $ContentStr .= date('Y-m-d H:i:s', $vo['insertTime']) . "\t";
                 $ContentStr .= date('Y-m-d H:i:s', $vo['commitTime']) . "\t";
                 if ($vo['isChecked'] == 1) {
                     $ContentStr .= "是\t\n";
                 } else {
                     $ContentStr .= "否\t\n";
                 }
             }
             $HeaderStr = iconv("UTF-8", "GBK", $HeaderStr);
             $ContentStr = iconv("UTF-8", "GBK", $ContentStr);
             echo $HeaderStr . $ContentStr;
             exit;
         } else {
             //错误提示
             $this->error('没有数据!');
         }
     }
 }
Ejemplo n.º 6
0
 public function export()
 {
     $map = array();
     $searchStr = '';
     $voList = array();
     $this->indexSearch($map, $searchStr);
     if (method_exists($this, 'listFilter')) {
         $this->listFilter($map);
     }
     $OrderBase = D('OrderBase');
     if (!empty($OrderBase)) {
         $voList = $this->exportList($OrderBase, $map);
     }
     if ($voList) {
         $FileName = date('Y-m-d') . "缺货登记.xls";
         $FileName = iconv("UTF-8", "GBK", $FileName);
         header("Content-Type: application/vnd.ms-execl");
         header("Content-Disposition: attachment; filename= {$FileName}");
         header("Pragma: no-cache");
         header("Expires: 0");
         /*first line*/
         $HeaderStr = "期数" . "\t";
         $HeaderStr .= "收货人" . "\t";
         $HeaderStr .= "电话" . "\t";
         $HeaderStr .= "地址" . "\t";
         $HeaderStr .= "省份" . "\t";
         $HeaderStr .= "城市" . "\t";
         $HeaderStr .= "报刊名称" . "\t";
         $HeaderStr .= "份数" . "\t";
         $HeaderStr .= "起期" . "\t";
         $HeaderStr .= "止期" . "\t";
         $HeaderStr .= "发行人" . "\t";
         $HeaderStr .= "发货方式" . "\t";
         $HeaderStr .= "单号" . "\t";
         $HeaderStr .= "缺货份数" . "\t";
         $HeaderStr .= "登记人" . "\t";
         $HeaderStr .= "登记日期" . "\t";
         $HeaderStr .= "备注" . "\t\n";
         $ContentStr = '';
         /*start of second line*/
         foreach ($voList as $vo) {
             $ContentStr .= get_magazine_terrm_name($vo['termID']) . "\t";
             $ContentStr .= $vo['recPeople'] . "\t";
             $ContentStr .= $vo['recTelphone'] . "\t";
             $ContentStr .= $vo['recAddress'] . "\t";
             $ContentStr .= get_province_name($vo['provinceID']) . "\t";
             $ContentStr .= $vo['cityName'] . "\t";
             $ContentStr .= get_magazine_name($vo['postCode']) . "\t";
             $ContentStr .= $vo['quantity'] . "\t";
             $ContentStr .= get_magazine_terrm_name($vo['beginTermID']) . "\t";
             $ContentStr .= get_magazine_terrm_name($vo['endTermID']) . "\t";
             $ContentStr .= get_employee_name($vo['postPeople']) . "\t";
             $ContentStr .= get_send_goods_type_name($vo['sendGoodsTypeID']) . "\t";
             $ContentStr .= $vo['sendGoodsID'] . "\t";
             $ContentStr .= $vo['renewQuantity'] . "\t";
             $ContentStr .= get_employee_name($vo['employeeID']) . "\t";
             $ContentStr .= date('Y-m-d', $vo['insertDate']) . "\t";
             $ContentStr .= $vo['memo'] . "\t\n";
         }
         $HeaderStr = iconv("UTF-8", "GBK", $HeaderStr);
         $ContentStr = iconv("UTF-8", "GBK", $ContentStr);
         echo $HeaderStr . $ContentStr;
         exit;
     } else {
         $this->error('没有数据!');
     }
 }
Ejemplo n.º 7
0
 function export()
 {
     $BeginDateTemp = '';
     $EndDateTemp = '';
     $SearchStr;
     $map = $this->_search();
     if (method_exists($this, '_filter')) {
         $this->_filter($map);
     }
     if ($_REQUEST['beginTime']) {
         $BeginDateTemp = strtotime($_REQUEST['beginTime']);
     }
     if ($_REQUEST['endTime']) {
         $EndDateTemp = strtotime($_REQUEST['endTime']);
     }
     $EmployeeNewspaper = D('EmployeeNewspaper');
     $EmployeeId = get_employeeid($_SESSION[C('USER_AUTH_KEY')]);
     $MagazineList = $EmployeeNewspaper->getEmployeeNespapers($EmployeeId);
     $MagazinePostCodes;
     foreach ($MagazineList as $vo) {
         $MagazinePostCodes .= $vo['postCode'] . ',';
     }
     $MagazinePostCodes = substr($MagazinePostCodes, 0, strlen($MagazinePostCodes) - 1);
     if ($MagazinePostCodes) {
         $map['postCode'] = array('in', $MagazinePostCodes);
     }
     if ($BeginDateTemp || $EndDateTemp) {
         if ($BeginDateTemp && $EndDateTemp) {
             $map['orderTime'] = array('between', "{$BeginDateTemp}, {$EndDateTemp}");
         } else {
             if ($BeginDateTemp) {
                 $map['orderTime'] = array('egt', $BeginDateTemp);
             } else {
                 $map['orderTime'] = array('elt', $EndDateTemp);
             }
         }
     }
     if (method_exists($this, '_filter')) {
         $this->_filter($map);
     }
     $model = D('OrderBase');
     if (!empty($model)) {
         $count = $model->where($map)->count('id');
         if ($count > 0) {
             import("ORG.Util.Page");
             $EmployeeId = get_employeeid($_SESSION[C('USER_AUTH_KEY')]);
             $EmployeeNewspaper = D('EmployeeNewspaper');
             $MagazineList = $EmployeeNewspaper->getEmployeeNespapers($EmployeeId);
             $MagazinePostCodes;
             foreach ($MagazineList as $vo) {
                 $MagazinePostCodes .= $vo['postCode'] . ',';
             }
             $MagazinePostCodes = substr($MagazinePostCodes, 0, strlen($MagazinePostCodes) - 1);
             if ($MagazinePostCodes) {
                 $map['postCode'] = array('in', $MagazinePostCodes);
             }
             $order = 'insertTime desc, employeeID desc, recPeople desc, postCode desc ';
             $voList = $model->where($map)->order($order)->select();
             $FileName = date('Y-m-d') . "订单派发数据.xls";
             $FileName = iconv("UTF-8", "GBK", $FileName);
             header("Content-Type: application/vnd.ms-execl");
             header("Content-Disposition: attachment; filename= {$FileName}");
             header("Pragma: no-cache");
             header("Expires: 0");
             /*first line*/
             $HeaderStr = "日期" . "\t";
             $HeaderStr .= "批次" . "\t";
             $HeaderStr .= "业务经理" . "\t";
             $HeaderStr .= "客户名称" . "\t";
             $HeaderStr .= "收货人" . "\t";
             $HeaderStr .= "省份" . "\t";
             $HeaderStr .= "城市" . "\t";
             $HeaderStr .= "单位" . "\t";
             $HeaderStr .= "班级" . "\t";
             $HeaderStr .= "手机" . "\t";
             $HeaderStr .= "地址" . "\t";
             $HeaderStr .= "报刊" . "\t";
             $HeaderStr .= "份数" . "\t";
             $HeaderStr .= "起月" . "\t";
             $HeaderStr .= "止月" . "\t";
             $HeaderStr .= "发货类型" . "\t";
             $HeaderStr .= "发货方式" . "\t";
             $HeaderStr .= "发货周期" . "\t";
             $HeaderStr .= "付款人" . "\t";
             $HeaderStr .= "是否派发" . "\t";
             $HeaderStr .= "派发时间" . "\t\n";
             $ContentStr = '';
             /*start of second line*/
             foreach ($voList as $vo) {
                 $ContentStr .= date('Y-m-d', $vo['orderTime']) . "\t";
                 $ContentStr .= $vo['batch'] . "\t";
                 $ContentStr .= get_employee_name($vo['employeeID']) . "\t";
                 $ContentStr .= get_custom_name($vo['customID']) . "\t";
                 $ContentStr .= $vo['recPeople'] . "\t";
                 $ContentStr .= get_province_name($vo['provinceID']) . "\t";
                 $ContentStr .= $vo['cityName'] . "\t";
                 $ContentStr .= get_custom_unit_name($vo['schoolID']) . "\t";
                 $ContentStr .= $vo['class'] . "\t";
                 $ContentStr .= $vo['recTelphone'] . "\t";
                 $ContentStr .= $vo['recAddress'] . "\t";
                 $ContentStr .= get_magazine_name($vo['postCode']) . "\t";
                 $ContentStr .= $vo['orderNum'] . "\t";
                 $ContentStr .= $vo['beginOrderDate'] . "\t";
                 $ContentStr .= $vo['endOrderDate'] . "\t";
                 $ContentStr .= get_send_goods_sort_name($vo['sendGoodsSortID']) . "\t";
                 $ContentStr .= get_send_goods_type_name($vo['sendGoodsTypeID']) . "\t";
                 $ContentStr .= get_send_order_cyle_name($vo['sendCyleID']) . "\t";
                 $ContentStr .= $vo['payPerson'] . "\t";
                 if ($vo['isSend']) {
                     $ContentStr .= "是\t";
                 } else {
                     $ContentStr .= "否\t";
                 }
                 if ($vo['sendTime']) {
                     $ContentStr .= date('Y-m-d', $vo['sendTime']) . "\t\n";
                 } else {
                     $ContentStr .= " \t\n";
                 }
             }
             $HeaderStr = iconv("UTF-8", "GBK", $HeaderStr);
             $ContentStr = iconv("UTF-8", "GBK", $ContentStr);
             echo $HeaderStr . $ContentStr;
             exit;
         } else {
             //错误提示
             $this->error('没有数据!');
         }
     }
 }
Ejemplo n.º 8
0
 public function export()
 {
     $map = array();
     $searchStr = '';
     $voList = array();
     $this->indexSearch($map, $searchStr);
     if (method_exists($this, 'listFilter')) {
         $this->listFilter($map);
     }
     $Feedback = D('Feedback');
     if (!empty($Feedback)) {
         $voList = $this->exportList($Feedback, $map);
     }
     if ($voList) {
         $FileName = date('Y-m-d') . "客户反馈信息.xls";
         $FileName = iconv("UTF-8", "GBK", $FileName);
         header("Content-Type: application/vnd.ms-execl");
         header("Content-Disposition: attachment; filename= {$FileName}");
         header("Pragma: no-cache");
         header("Expires: 0");
         /*first line*/
         $HeaderStr = "客户姓名" . "\t";
         $HeaderStr .= "联系人" . "\t";
         $HeaderStr .= "电话" . "\t";
         $HeaderStr .= "报刊名称" . "\t";
         $HeaderStr .= "年度" . "\t";
         $HeaderStr .= "月份" . "\t";
         $HeaderStr .= "期数" . "\t";
         $HeaderStr .= "反馈内容" . "\t";
         $HeaderStr .= "处理结果" . "\t";
         $HeaderStr .= "处理人" . "\t";
         $HeaderStr .= "处理时间" . "\t";
         $HeaderStr .= "录入人" . "\t";
         $HeaderStr .= "录入时间" . "\t\n";
         $ContentStr = '';
         /*start of second line*/
         foreach ($voList as $vo) {
             $ContentStr .= $vo['customName'] . "\t";
             $ContentStr .= $vo['contactPerson'] . "\t";
             $ContentStr .= $vo['tel'] . "\t";
             $ContentStr .= $vo['magazineName'] . "\t";
             $ContentStr .= $vo['year'] . "\t";
             $ContentStr .= $vo['month'] . "\t";
             $ContentStr .= $vo['term'] . "\t";
             $ContentStr .= $vo['content'] . "\t";
             $ContentStr .= $vo['result'] . "\t";
             $ContentStr .= get_employee_name($vo['resultPersonID']) . "\t";
             $ContentStr .= date('Y-m-d', $vo['resultTime']) . "\t";
             $ContentStr .= get_employee_name($vo['employeeID']) . "\t";
             $ContentStr .= date('Y-m-d', $vo['insertDate']) . "\t\n";
         }
         $HeaderStr = iconv("UTF-8", "GBK", $HeaderStr);
         $ContentStr = iconv("UTF-8", "GBK", $ContentStr);
         echo $HeaderStr . $ContentStr;
         exit;
     } else {
         $this->error('没有数据!');
     }
 }
Ejemplo n.º 9
0
 public function export()
 {
     $map = array();
     $voList = array();
     $this->searchMap($map, $SearchSql);
     if ($map) {
         if ($roleEname == "businessManager") {
             $map['order_base.employeeID'] = $EmployeeId;
         }
     }
     $model = D('OrderBase');
     if (!empty($model)) {
         $voList = $this->exportList($model, $map);
     }
     if ($voList) {
         $FileName = date('Y-m-d') . "订单跟踪.xls";
         $FileName = iconv("UTF-8", "GBK", $FileName);
         header("Content-Type: application/vnd.ms-execl");
         header("Content-Disposition: attachment; filename= {$FileName}");
         header("Pragma: no-cache");
         header("Expires: 0");
         /*first line*/
         $HeaderStr = "订单编号" . "\t";
         $HeaderStr .= "批次" . "\t";
         $HeaderStr .= "报刊名称" . "\t";
         $HeaderStr .= "期数" . "\t";
         $HeaderStr .= "收货人" . "\t";
         $HeaderStr .= "收货人电话" . "\t";
         $HeaderStr .= "审核状态" . "\t";
         $HeaderStr .= "审核时间" . "\t";
         $HeaderStr .= "派送状态" . "\t";
         $HeaderStr .= "派送时间" . "\t";
         $HeaderStr .= "接收状态" . "\t";
         $HeaderStr .= "接收时间" . "\t";
         $HeaderStr .= "分配状态" . "\t";
         $HeaderStr .= "分配时间" . "\t";
         $HeaderStr .= "打印状态" . "\t";
         $HeaderStr .= "打印时间" . "\t";
         $HeaderStr .= "质检员" . "\t";
         $HeaderStr .= "质检时间" . "\t";
         $HeaderStr .= "票号" . "\t";
         $HeaderStr .= "发货方式" . "\t\n";
         $ContentStr = '';
         /* start of second line */
         foreach ($voList as $vo) {
             $ContentStr .= $vo['contractID'] . "\t";
             $ContentStr .= $vo['batch'] . "\t";
             $ContentStr .= $vo['magazineName'] . "\t";
             $ContentStr .= $vo['termName'] . "\t";
             $ContentStr .= $vo['recPeople'] . "\t";
             $ContentStr .= $vo['recTelphone'] . "\t";
             $ContentStr .= $vo['orderStatus'] . "\t";
             if ($vo['isChecked']) {
                 $ContentStr .= "已审\t";
             } else {
                 $ContentStr .= "未审\t";
             }
             if ($vo['checkTime'] != 0) {
                 $ContentStr .= date('Y-m-d H:s', $vo['checkTime']) . "\t";
             } else {
                 $ContentStr .= "\t";
             }
             if ($vo['isSend']) {
                 $ContentStr .= "已派送\t";
             } else {
                 $ContentStr .= "未派送\t";
             }
             if ($vo['sendTime'] != 0) {
                 $ContentStr .= date('Y-m-d H:s', $vo['sendTime']) . "\t";
             } else {
                 $ContentStr .= "\t";
             }
             if ($vo['isReceive']) {
                 $ContentStr .= "已接收\t";
             } else {
                 $ContentStr .= "未接收\t";
             }
             if ($vo['receiveTime'] != 0) {
                 $ContentStr .= date('Y-m-d H:s', $vo['receiveTime']) . "\t";
             } else {
                 $ContentStr .= "\t";
             }
             if ($vo['isCheckOut']) {
                 $ContentStr .= "已分配\t";
             } else {
                 $ContentStr .= "未分配\t";
             }
             if ($vo['checkOutTime'] != 0) {
                 $ContentStr .= date('Y-m-d H:s', $vo['checkOutTime']) . "\t";
             } else {
                 $ContentStr .= "\t";
             }
             if ($vo['isPrintCheckOut']) {
                 $ContentStr .= "已打印\t";
             } else {
                 $ContentStr .= "未打印\t";
             }
             if ($vo['printCheckOutTime'] != 0) {
                 $ContentStr .= date('Y-m-d H:s', $vo['printCheckOutTime']) . "\t";
             } else {
                 $ContentStr .= "\t";
             }
             if ($vo['checkID']) {
                 $ContentStr .= get_employee_name($vo['checkID']) . "\t";
             } else {
                 $ContentStr .= "\t";
             }
             if ($vo['checkDate'] != 0) {
                 $ContentStr .= date('Y-m-d H:s', $vo['checkDate']) . "\t";
             } else {
                 $ContentStr .= "\t";
             }
             $ContentStr .= $vo["sendGoodsID"] . "\t";
             $ContentStr .= $vo["sendGoodsTypeName"] . "\t\n";
         }
         $HeaderStr = iconv("UTF-8", "GBK", $HeaderStr);
         $ContentStr = iconv("UTF-8", "GBK", $ContentStr);
         echo $HeaderStr . $ContentStr;
         exit;
     } else {
         $this->error('没有数据!');
     }
 }