示例#1
0
 public function view_showForm()
 {
     global $memc_obj;
     $pagesize = 200;
     //页面大小
     $whereSql = $this->buildWhereSql();
     //echo $whereSql;exit;
     $packorder_obj = new PackingOrderModel();
     $rownumber = $packorder_obj->getRowAllNumber($whereSql . ' group by po.id ');
     //获得所有的行数
     $pager = new Page($rownumber, $pagesize);
     $billlist = $packorder_obj->getBillList($whereSql . ' group by po.id order by pd.pName ' . $pager->limit);
     //更具条件获得发货单
     $packorder_obj->buildOrderinfo($billlist);
     /*
             //去除重复的
             $currentid = NULL;
             $prekey = 0;
             foreach ($billlist as $key=>$valbill){
                 if ($currentid == $valbill['id']) {
                 	$billlist[$prekey]['originOrderId'] .= ', '.$valbill['originOrderId'];
                 	unset($billlist[$key]);
                 }else {
                     $prekey = $key;
                     $currentid = $valbill['id'];
                 }
             }
     */
     $materInfo = CommonModel::getMaterInfoAll();
     //获取包材信息
     $materInfo = reverse_array($materInfo, 'pmName', 'id');
     $shipingtyplist = CommonModel::getShipingTypeList();
     //运输方式列表
     $shipingtyplist = reverse_array($shipingtyplist, 'carrierNameCn', 'id');
     $salesaccountlist = CommonModel::getSalesaccountList();
     //获取销售帐号
     $salesaccountlist = reverse_array($salesaccountlist, 'account', 'id');
     //print_r($salesaccountlist);exit;
     $platformList = CommonModel::getPlatformInfo();
     //获取平台帐号
     $platformList = reverse_array($platformList, 'platform', 'id');
     $this->smarty->assign('shipingtypelist', $shipingtyplist);
     $this->smarty->assign('salesaccountlist', $salesaccountlist);
     $this->smarty->assign('platformList', $platformList);
     foreach ($billlist as $key => $valbil) {
         $tracknumber = '';
         $str_info = OmAvailableModel::getTNameList("wh_order_tracknumber", "tracknumber", "where shipOrderId='{$valbil['id']}' and is_delete=0");
         if (!empty($str_info)) {
             $tracknumber = $str_info[0]['tracknumber'];
         }
         $billlist[$key]['tracknumber'] = $tracknumber;
         $originOrder_arr = array();
         $originOrder_str = '';
         $originOrder_info = OmAvailableModel::getTNameList("wh_shipping_order_relation", "originOrderId", "where shipOrderId='{$valbil['id']}'");
         if (!empty($originOrder_info)) {
             foreach ($originOrder_info as $originOrder) {
                 $originOrder_arr[] = $originOrder['originOrderId'];
             }
             $originOrder_str = implode(',', $originOrder_arr);
         }
         $billlist[$key]['originOrder'] = $originOrder_str;
         //运输方式
         $billlist[$key]['shipingname'] = $shipingtyplist[$valbil['transportId']];
         //包材
         $billlist[$key]['materName'] = $materInfo[$valbil['pmId']];
         //平台
         $billlist[$key]['platformName'] = $platformList[$valbil['platformId']];
         //销售账号
         $billlist[$key]['salesaccountinfo'] = $salesaccountlist[$valbil['accountId']];
     }
     if ($rownumber > $pagesize) {
         //分页
         $pagestr = $pager->fpage(array(0, 2, 3, 4, 5, 6, 7, 8, 9));
     } else {
         $pagestr = $pager->fpage(array(0, 2, 3));
     }
     $this->smarty->assign('pagestr', $pagestr);
     $this->smarty->assign('billlist', $billlist);
     //发货单列表
     $this->smarty->assign('secnev', 3);
     $libstu_obj = new LibraryStatusModel();
     //出库状态类型
     $libstatuslist = $libstu_obj->getAllLibStatusList(' and groupId in (4 ,5)');
     $this->smarty->assign('outstatuslist', $libstatuslist);
     $toptitle = '订单查询';
     //头部title
     $this->smarty->assign('toptitle', $toptitle);
     $storeId = isset($_GET['storeId']) ? intval($_GET['storeId']) : 0;
     if ($storeId == 1) {
         $navlist = array(array('url' => '', 'title' => '出库'), array('url' => '', 'title' => '发货单查询'), array('url' => '', 'title' => 'A仓发货单'));
     } elseif ($storeId == 2) {
         $navlist = array(array('url' => '', 'title' => '出库'), array('url' => '', 'title' => '发货单查询'), array('url' => '', 'title' => 'B仓发货单'));
     } else {
         $navlist = array(array('url' => '', 'title' => '出库'), array('url' => '', 'title' => '发货单查询'));
     }
     $this->smarty->assign('navlist', $navlist);
     $toplevel = 2;
     //一级菜单的序号  0 开始
     $this->smarty->assign('toplevel', $toplevel);
     $secondlevel = isset($_GET['secondlevel']) ? trim($_GET['secondlevel']) : '';
     if (empty($secondlevel)) {
         $secondlevel = '21';
         //当前的二级菜单
     }
     $this->smarty->assign('secondlevel', $secondlevel);
     $this->smarty->assign('platLists', $_SESSION['platformList']);
     $this->smarty->assign('accounts', $_SESSION['accountList']);
     $this->smarty->assign('shippingList', $_SESSION['shippingList']);
     $this->smarty->display('dispatchbillquery.htm');
 }
示例#2
0
 $receive_info = array();
 //区域路由
 /*$receive_area   =   WhWaveReceiveRecordModel::select(array('waveId'=>$wave['id'], 'order by'=> 'id asc'), 'area');
   if(!empty($receive_area)){
       foreach($receive_area as $v){
           $receive_info   .=  " {$v['area']} =>";
       }
       $receive_info   =   trim($receive_info, '=>');
   }*/
 $page_num = 35;
 $scan_record = WhWaveScanRecordModel::get_scan_record_union_area($wave['id']);
 //获取配货记录及区域负责人id
 //print_r($scan_record);exit;
 $area_info = array_unique(get_filed_array('area', $scan_record));
 $area_user = WhWaveAreaUserRelationModel::get_user_by_areaName($area_info);
 $area_user = reverse_array($area_user, 'user', 'area');
 $note = '';
 /** 获取单发货单配货备注**/
 if ($wave['waveType'] == 1) {
     $note = WhShippingOrderNoteRecordModel::get_order_note_by_waveId($wave['id']);
     if (!empty($note)) {
         $note = get_filed_array('content', $note);
         $note = implode("<br />", $note);
     } else {
         $note = '';
     }
 }
 /** **/
 //print_r($area_info);exit;
 $receive_info = implode(' =>', $area_info);
 $count = count($scan_record);
echo '*************<br />';
// reverse an array without using the array_reverse php function - write your own
$forwardarray = array('Abby', 'Bruce', 'Carl', 'Dawn', 'Edgar', 'Francine');
function reverse_array($entries)
{
    $forwardi = 0;
    for ($i = count($entries) - 1; $i >= 0; $i--) {
        $backwardarray[$forwardi] = $entries[$i];
        $forwardi += 1;
    }
    return $backwardarray;
}
echo 'This is the original array:<br />';
var_dump($forwardarray);
echo '<br /> This is the reversed array:<br />';
var_dump(reverse_array($forwardarray));
echo '*************<br />';
// locate a string in an array without using in_array - write your own
$haystack = array('needle', 'thread', 'bobbin', 'spool', 'yarn', 'Needle');
function locate_in_array($arr, $findit)
{
    $found = 'no';
    foreach ($arr as $arritem) {
        if ($arritem == $findit) {
            $found = 'yes';
            break;
        }
    }
    return $found;
}
echo 'This is the haystack:<br/>';
function mc_produce_upcoming_events($events, $template, $type = 'list', $order = 'asc', $skip = 0, $before, $after, $show_today = 'yes', $context = 'filters')
{
    // $events has +5 before and +5 after if those values are non-zero.
    // $events equals array of events based on before/after queries. Nothing skipped, order is not set, holiday conflicts removed.
    $output = array();
    $near_events = $temp_array = array();
    $past = $future = 1;
    $now = current_time('timestamp');
    $today = date('Y', $now) . '-' . date('m', $now) . '-' . date('d', $now);
    @uksort($events, "my_calendar_timediff_cmp");
    // sort all events by proximity to current date
    $count = count($events);
    $group = array();
    $spans = array();
    $extra = 0;
    $i = 0;
    // create near_events array
    $last_events = $last_group = array();
    if (is_array($events)) {
        foreach ($events as $k => $event) {
            if ($i < $count) {
                if (is_array($event)) {
                    foreach ($event as $e) {
                        if ($e->category_private == 1 && !is_user_logged_in()) {
                        } else {
                            $beginning = $e->occur_begin;
                            $end = $e->occur_end;
                            // store span time in an array to avoid repeating database query
                            if ($e->event_span == 1 && !isset($spans[$e->occur_group_id])) {
                                // this is a multi-day event: treat each event as if it spanned the entire range of the group.
                                $span_time = mc_span_time($e->occur_group_id);
                                $beginning = $span_time[0];
                                $end = $span_time[1];
                                $spans[$e->occur_group_id] = $span_time;
                            } else {
                                if ($e->event_span == 1 && isset($spans[$e->occur_group_id])) {
                                    $span_time = $spans[$e->occur_group_id];
                                    $beginning = $span_time[0];
                                    $end = $span_time[1];
                                }
                            }
                            $current = date('Y-m-d H:i:00', current_time('timestamp'));
                            if ($e) {
                                // if a multi-day event, show only once.
                                if ($e->occur_group_id != 0 && $e->event_span == 1 && in_array($e->occur_group_id, $group)) {
                                    $md = true;
                                } else {
                                    $group[] = $e->occur_group_id;
                                    $md = false;
                                }
                                // end multi-day reduction
                                if (!$md) {
                                    // check if this event instance or this event group has already been displayed
                                    $same_event = in_array($e->occur_id, $last_events) ? true : false;
                                    $same_group = in_array($e->occur_group_id, $last_group) ? true : false;
                                    if ($show_today == 'yes' && my_calendar_date_equal($beginning, $current)) {
                                        $in_total = 'yes';
                                        // count todays events in total
                                        if ($in_total != 'no') {
                                            $near_events[] = $e;
                                            $future++;
                                        } else {
                                            $near_events[] = $e;
                                        }
                                    } else {
                                        if ($past <= $before && $future <= $after) {
                                            $near_events[] = $e;
                                            // if neither limit is reached, split off freely
                                        } else {
                                            if ($past <= $before && my_calendar_date_comp($beginning, $current)) {
                                                $near_events[] = $e;
                                                // split off another past event
                                            } else {
                                                if ($future <= $after && !my_calendar_date_comp($end, $current)) {
                                                    $near_events[] = $e;
                                                    // split off another future event
                                                }
                                            }
                                        }
                                    }
                                    if (my_calendar_date_comp($beginning, $current)) {
                                        if (!$same_event && !$same_group) {
                                            $past++;
                                        }
                                    } else {
                                        if (my_calendar_date_equal($beginning, $current)) {
                                            if ($show_today == 'yes') {
                                                $extra++;
                                            }
                                        } else {
                                            if (!my_calendar_date_comp($end, $current)) {
                                                if (!$same_event && !$same_group) {
                                                    $future++;
                                                }
                                            }
                                        }
                                    }
                                    $last_events[] = $e->occur_id;
                                    $last_group[] = $e->occur_group_id;
                                    $last_date = $beginning;
                                }
                                if ($past > $before && $future > $after && $show_today != 'yes') {
                                    break;
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    $events = $near_events;
    @usort($events, "my_calendar_datetime_cmp");
    // sort split events by date
    if (is_array($events)) {
        foreach (array_keys($events) as $key) {
            $event =& $events[$key];
            //echo $event->event_title . " " . $event->event_group_id."<br />";
            $event_details = mc_create_tags($event, $context);
            if (get_option('mc_event_approve') == 'true') {
                if ($event->event_approved != 0) {
                    $temp_array[] = $event_details;
                }
            } else {
                $temp_array[] = $event_details;
            }
        }
        $i = 0;
        $groups = array();
        $skips = array();
        foreach (reverse_array($temp_array, true, $order) as $details) {
            if (!in_array($details['group'], $groups)) {
                $date = date('Y-m-d', strtotime($details['dtstart']));
                $class = my_calendar_date_comp($date, $today) === true ? "past-event" : "future-event";
                if (my_calendar_date_equal($date, $today)) {
                    $class = "today";
                }
                if ($details['event_span'] == 1) {
                    $class = "multiday";
                }
                if ($type == 'list') {
                    $prepend = "\n<li class=\"{$class}\">";
                    $append = "</li>\n";
                } else {
                    $prepend = $append = '';
                }
                if ($i < $skip && $skip != 0) {
                    $i++;
                } else {
                    if (!in_array($details['dateid'], $skips)) {
                        $output[] = apply_filters('mc_event_upcoming', "{$prepend}" . jd_draw_template($details, $template, $type) . "{$append}", $event);
                        $skips[] = $details['dateid'];
                    }
                }
                if ($details['event_span'] == 1) {
                    $groups[] = $details['group'];
                }
            }
        }
    }
    // If more items than there should be (due to handling of current-day's events), pop off.
    $intended = $before + $after + $extra;
    $actual = count($output);
    if ($actual > $intended) {
        for ($i = 0; $i < $actual - $intended; $i++) {
            array_pop($output);
        }
    }
    $html = '';
    foreach ($output as $out) {
        $html .= $out;
    }
    return $html;
}