当前位置: 首页>>代码示例>>PHP>>正文


PHP System_helper::ExcelToPHPDate方法代码示例

本文整理汇总了PHP中System_helper::ExcelToPHPDate方法的典型用法代码示例。如果您正苦于以下问题:PHP System_helper::ExcelToPHPDate方法的具体用法?PHP System_helper::ExcelToPHPDate怎么用?PHP System_helper::ExcelToPHPDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System_helper的用法示例。


在下文中一共展示了System_helper::ExcelToPHPDate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: upload_excel_file

 public function upload_excel_file()
 {
     $user = User_helper::get_user();
     if ($_FILES["file"]['name'] != "") {
         $arr = explode(".", $_FILES["file"]['name']);
         $ext = $arr[sizeof($arr) - 1];
     }
     $size = $_FILES["file"]['size'];
     $this->load->library('upload');
     $fileName = 'template_' . $user->id . '_' . date('Ymdhis');
     if ($ext == 'xls' || $ext == 'xlsx') {
         System_helper::upload_excel_file($fileName, $save_dir = "uploads/excel", $max_size = 60000, $types = 'xls|xlsx');
         if ($ext == 'xls') {
             $path = "uploads/excel/" . $fileName . '.xls';
         } else {
             $path = "uploads/excel/" . $fileName . '.xlsx';
         }
         if ($size < 60000) {
             $i = 0;
             $totalcount = 0;
             $objPHPExcel = PHPExcel_IOFactory::load($path);
             foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) {
                 $worksheetTitle = $worksheet->getTitle();
                 $highestRow = $worksheet->getHighestRow();
                 $highestColumn = $worksheet->getHighestColumn();
                 $highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn);
                 $nrColumns = ord($highestColumn) - 64;
                 for ($row = 1; $row <= $highestRow; ++$row) {
                     for ($col = 0; $col < $highestColumnIndex; ++$col) {
                         $cell = $worksheet->getCellByColumnAndRow($col, $row);
                         $val = $cell->getValue();
                         $dataType = PHPExcel_Cell_DataType::dataTypeForValue($val);
                     }
                 }
             }
             $total_men = 0;
             $total_women = 0;
             $total_tribe = 0;
             $total_disability = 0;
             $total_services = 0;
             $total_income = 0;
             $check_income = false;
             for ($row = 3; $row <= $highestRow; ++$row) {
                 $val = array();
                 for ($col = 0; $col < $highestColumnIndex; ++$col) {
                     $cell = $worksheet->getCellByColumnAndRow($col, $row);
                     $val[] = $cell->getValue();
                 }
                 if ($val[3] != "" && $val[3] != null) {
                     $serial[$i] = System_helper::Get_Bng_to_Eng($val[0]);
                     $customer_name[$i] = $val[1];
                     $gender[$i] = $val[2];
                     $service_name[$i] = $val[3];
                     $amount[$i] = System_helper::Get_Bng_to_Eng(abs($val[4]));
                     if (strlen($amount[$i]) > 6) {
                         $check_income = true;
                     }
                     if ($this->Service_template_model->check_uisc_service_existence($service_name[$i])) {
                         $totalcount = $totalcount + $i;
                         $total_services++;
                         $total_income = $total_income + System_helper::Get_Bng_to_Eng($amount[$i]);
                         if ($gender[$i] == $this->lang->line('MALE_VAL')) {
                             $total_men++;
                         } elseif ($gender[$i] == $this->lang->line('FEMALE_VAL')) {
                             $total_women++;
                         } elseif ($gender[$i] == $this->lang->line('TRIBE_VAL')) {
                             $total_tribe++;
                         } elseif ($gender[$i] == $this->lang->line('DISABILITY_VAL')) {
                             $total_disability++;
                         }
                     }
                     ++$i;
                 }
             }
             $DateCell = $worksheet->getCellByColumnAndRow('1', '1');
             $invDateRaw = $DateCell->getValue();
             if (is_float($invDateRaw)) {
                 $newDate = System_helper::ExcelToPHPDate($invDateRaw);
                 $invDate = date('Y-m-d', $newDate);
             } else {
                 $invDate = $invDateRaw;
             }
             if ($this->Service_template_model->chk_existing_uploded_excel_file($invDate) < 2) {
                 $invoice_data = array();
                 $zilla_invoice_data = array();
                 $invoice_details_data = array();
                 $zilla_invoice_details_data = array();
                 $user_zilla = $user->zilla;
                 $zilla_table_invoice = str_pad($user_zilla, 2, "0", STR_PAD_LEFT) . '_invoices';
                 $zilla_table_invoice_details = str_pad($user_zilla, 2, "0", STR_PAD_LEFT) . '_invoice_details';
                 $uisc_id = $user->uisc_id;
                 $user_group_id = $user->user_group_id;
                 $division = $user->division;
                 $zilla = $user->zilla;
                 $upazila = $user->upazila;
                 $unioun = $user->unioun;
                 $citycorporation = $user->citycorporation;
                 //$citycorporationward = $user->citycorporationward;
                 $municipal = $user->municipal;
                 //$municipalward = $user->municipalward;
//.........这里部分代码省略.........
开发者ID:marajmmc,项目名称:asset,代码行数:101,代码来源:Service_template.php


注:本文中的System_helper::ExcelToPHPDate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。