コード例 #1
0
 public function cuentaClienteExcel()
 {
     $res = $this->getCuentaClienteData();
     if (count($res['anterior']) > 0) {
         $res['anterior'] = $res['anterior'][0];
     }
     $this->load->library('myexcel');
     $xls = new myexcel();
     $worksheet =& $xls->workbook->addWorksheet();
     $xls->titulo2 = 'Cuenta de ' . $res['cliente']->nombre_fiscal;
     $xls->titulo3 = 'Del: ' . $this->input->get('ffecha1') . " Al " . $this->input->get('ffecha2') . "\n";
     $xls->titulo4 = $this->input->get('ftipo') == 'pv' ? 'Plazo vencido' : 'Pendientes por cobrar';
     if (is_array($res['anterior'])) {
         $res['anterior'] = new stdClass();
         $res['anterior']->cargo = 0;
         $res['anterior']->abono = 0;
         $res['anterior']->saldo = 0;
     } else {
         $res['anterior']->cargo = $res['anterior']->total;
         $res['anterior']->abono = $res['anterior']->abonos;
     }
     $res['anterior']->fecha = $res['anterior']->serie = $res['anterior']->folio = '';
     $res['anterior']->concepto = $res['anterior']->estado = $res['anterior']->fecha_vencimiento = '';
     $res['anterior']->dias_transc = '';
     array_unshift($res['cuentas'], $res['anterior']);
     $data_fac = $res['cuentas'];
     $row = 0;
     //Header
     $xls->excelHead($worksheet, $row, 8, array(array($xls->titulo2, 'format_title2'), array($xls->titulo3, 'format_title3'), array($xls->titulo4, 'format_title3')));
     $row += 3;
     $xls->excelContent($worksheet, $row, $data_fac, array('head' => array('Fecha', 'Serie', 'Folio', 'Concepto', 'Cargo', 'Abono', 'Saldo', 'Estado', 'Fecha Vencimiento', 'Dias Trans.'), 'conte' => array(array('name' => 'fecha', 'format' => 'format4', 'sum' => -1), array('name' => 'serie', 'format' => 'format4', 'sum' => -1), array('name' => 'folio', 'format' => 'format4', 'sum' => -1), array('name' => 'concepto', 'format' => 'format4', 'sum' => -1), array('name' => 'cargo', 'format' => 'format4', 'sum' => 0), array('name' => 'abono', 'format' => 'format4', 'sum' => 0), array('name' => 'saldo', 'format' => 'format4', 'sum' => 0), array('name' => 'estado', 'format' => 'format4', 'sum' => -1), array('name' => 'fecha_vencimiento', 'format' => 'format4', 'sum' => -1), array('name' => 'dias_transc', 'format' => 'format4', 'sum' => -1))));
     $xls->workbook->send('cuentaProveedor.xls');
     $xls->workbook->close();
 }
コード例 #2
0
 /**
  *  
  */
 public function nominaPilotoExcel()
 {
     $res = $this->getDetallePiloto();
     $this->load->library('myexcel');
     $xls = new myexcel();
     $worksheet =& $xls->workbook->addWorksheet();
     $xls->titulo2 = 'Cuenta de ' . $res['piloto']->nombre;
     $xls->titulo3 = 'Del: ' . $this->input->get('ffecha1') . " Al " . $this->input->get('ffecha2') . "\n";
     // 		$xls->titulo4 = ($this->input->get('ftipo') == 'pv'? 'Plazo vencido': 'Pendientes por pagar');
     $total_cargo = $total_abono = $total_saldo = $cantidad_vuelos = 0;
     if (isset($res['anterior']->total_saldo)) {
         //se suma a los totales del saldo anterior
         $total_cargo += $res['anterior']->total_vuelos;
         $total_abono += $res['anterior']->total_abonos;
         $total_saldo += $res['anterior']->total_saldo;
     } else {
         $res['anterior'] = new stdClass();
         $res['anterior']->total_vuelos = 0;
         $res['anterior']->total_abonos = 0;
         $res['anterior']->total_saldo = 0;
     }
     $res['anterior']->fecha = $res['anterior']->matricula = $res['anterior']->cantidad_vuelos = '';
     $res['anterior']->descripcion = '';
     foreach ($res['cuentas'] as $item) {
         if ($item->tipo == 'vu') {
             $cantidad_vuelos += $item->cantidad_vuelos;
             $total_cargo += $item->total_vuelos;
             $total_saldo += $item->total_vuelos;
         } elseif ($item->tipo == 'ab') {
             $item->cantidad_vuelos = '';
             $total_abono += $item->total_abonos;
             $total_saldo -= $item->total_abonos;
         }
         $item->total_saldo = $total_saldo;
     }
     $res['totales'] = new stdClass();
     $res['totales']->fecha = $res['totales']->matricula = '';
     $res['totales']->cantidad_vuelos = $cantidad_vuelos;
     $res['totales']->descripcion = '';
     $res['totales']->total_vuelos = $total_cargo;
     $res['totales']->total_abonos = $total_abono;
     $res['totales']->total_saldo = $total_saldo;
     $res['totales']->is_total_final = true;
     array_unshift($res['cuentas'], $res['anterior']);
     $res['cuentas'][] = $res['totales'];
     $data_fac = $res['cuentas'];
     $row = 0;
     //Header
     $xls->excelHead($worksheet, $row, 8, array(array($xls->titulo2, 'format_title2'), array($xls->titulo3, 'format_title3')));
     $row += 3;
     $xls->excelContent($worksheet, $row, $data_fac, array('head' => array('Fecha', 'Avion', 'Cantidad', 'Descripcion', 'Vuelos', 'Abonos', 'Saldo'), 'conte' => array(array('name' => 'fecha', 'format' => 'format4', 'sum' => -1), array('name' => 'matricula', 'format' => 'format4', 'sum' => -1), array('name' => 'cantidad_vuelos', 'format' => 'format4', 'sum' => -1), array('name' => 'descripcion', 'format' => 'format4', 'sum' => -1), array('name' => 'total_vuelos', 'format' => 'format4', 'sum' => -1), array('name' => 'total_abonos', 'format' => 'format4', 'sum' => -1), array('name' => 'total_saldo', 'format' => 'format4', 'sum' => -1))));
     $xls->workbook->send('nominaPiloto.xls');
     $xls->workbook->close();
 }
コード例 #3
0
 public function exportinfo()
 {
     /* 权限检查 订单列表 */
     role::check('user_draw_money_review');
     if (empty($_POST)) {
         remind::set(Kohana::lang('o_global.bad_request'), 'order/user_draw_money/index/hascharge');
     }
     $request_data = $this->input->post();
     if (empty($request_data['order_ids'])) {
         remind::set(Kohana::lang('o_global.bad_request'), 'order/user_draw_money/index/hascharge');
     }
     $user_draw_moeny = User_draw_moneyService::get_instance();
     $query_struct = array();
     $query_struct['where']['id'] = $request_data['order_ids'];
     $results = $user_draw_moeny->query_assoc($query_struct);
     $expexcel = array();
     $m = 0;
     $expexcel[$m] = array('日期', '总金额', '总笔数', '支付宝帐号', '', '', '', '', '', '');
     $all_money = 0;
     $all_count = 0;
     $infos = array();
     foreach ($results as $key => $value) {
         $row = array();
         $row[] = ' ' . $value['id'];
         $row[] = $value['truename'];
         $row[] = ' ' . $value['account'];
         $row[] = $value['bank_name'];
         $row[] = $value['province'];
         $row[] = $value['city'];
         $row[] = $value['bank_found'];
         $row[] = $value['money'];
         $row[] = ' 2';
         $row[] = $value['memo'];
         //str_replace("\n", ";", $value['memo']);
         $all_money = $all_money + $value['money'];
         $infos[] = $row;
         $all_count++;
     }
     $alipay_config = Kohana::config('site_config.site.alipay_account');
     $m++;
     $expexcel[$m][] = date('Y-m-d');
     $expexcel[$m][] = ' ' . $all_money;
     $expexcel[$m][] = ' ' . $all_count;
     $expexcel[$m][] = $alipay_config;
     $expexcel[$m][] = '';
     $expexcel[$m][] = '';
     $expexcel[$m][] = '';
     $expexcel[$m][] = '';
     $expexcel[$m][] = '';
     $expexcel[$m][] = '';
     $m++;
     $expexcel[$m] = array('商户流水号', '收款银行户名', '收款银行帐号', '收款开户银行', '收款银行所在省份', '收款银行所在市', '收款支行名称', '金额', '对公对私标志', '备注');
     $expexcel = array_merge($expexcel, $infos);
     myexcel::get_instance()->get_excel_from_rows($expexcel, '会员提现财务导出');
     //添加日志
     $logs_data = array();
     $logs_data['manager_id'] = $this->manager_id;
     $logs_data['user_log_type'] = 30;
     $logs_data['ip'] = tool::get_long_ip();
     $logs_data['memo'] = "成功导出选定款项款项,id:" . implode(',', $request_data['order_ids']);
     ulog::instance()->add($logs_data);
     exit;
 }