Exemplo n.º 1
0
 public function ReportAffiliate($token)
 {
     $header = array(array('INSTITUCION DE PREVISION SOCIAL DEL PERIODISTA'), array('Carnet: ', '', ' Fecha Nacimiento: ', ' ', 'Edad: ', 'Fecha Ingreso: '), array('Nombre: '), array('Tiempo de jubilación Voluntaria: '), array('Tiempo de jubilación Obligatorio: '), array('Pago de Cuotas Sector Privado '), array(''), array('Año', 'Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'));
     $dues = $this->duesRepository->getModel()->where('affiliate_id', $affiliate->id)->orderBy('date_payment', 'ASC')->get();
     if (!$dues->isEmpty()) {
         //"01/01/1995"
         $old_year = Carbon::format($dues[0]->date_payment)->getFullYear();
         //1995
         $last_year = Carbon::format($dues[count($dues) - 1])->getFullYear();
         //2014
         for ($i = $old_year; $i <= $last_year; $i++) {
             $row[] = $i;
             for ($j = 1; $j <= 12; $j++) {
                 # code...
                 foreach ($dues as $key => $value) {
                     if ($value->date_payment == "01/" . $j . "/" . $i) {
                         array_push($row, $value->amount);
                     } else {
                         array_push($row, "");
                     }
                 }
             }
             array_push($header, $row);
         }
     }
     echo json_encode($header);
     die;
     /*   foreach ($dues as $due) {
              $duesYear =  $this->duesRepository->getModel()->where('date_payment',$affiliate->id)->where('affiliate_id',$affiliate->id)->orderBy('date_payment','ASC')->get();
              foreach(){
                  $header[] = ['Año','Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'];
              }
              
          }*/
 }
Exemplo n.º 2
0
 public function niceDateRange(Carbon $date1 = null, Carbon $date2 = null, $ordinalSuffixRequired = false)
 {
     $ordinalSuffix = "";
     $day1 = $date1->day;
     $day2 = $date2->day;
     $month1 = $date1->month;
     $month2 = $date2->month;
     //$ordinalSuffix = FormatMe::toOrdinalSuffix($day2);
     $restOfDate = $date2->format('F Y');
     $myDateString = "{$day1}-{$day2}" . $ordinalSuffix;
     // if months are not the same, display both months in range
     if ($month1 !== $month2) {
         return "{$day1} " . $date1->format('F') . " &ndash; " . "{$day2} " . $date2->format('F Y');
     }
     return $myDateString . ' ' . $restOfDate;
 }
Exemplo n.º 3
0
 public function dueDate()
 {
     $settings = APSetting::first();
     $generated_on = new Carbon($this->generated_on);
     $generated_on->addDays($settings->payment_due_in_days);
     return $generated_on->format('d M y');
 }
Exemplo n.º 4
0
 private function calculateHolidays($country, $fromYear, $toYear)
 {
     $return = [];
     if ($fromYear == $toYear) {
         $years = [$fromYear];
     } else {
         $years = [$fromYear, $toYear];
     }
     foreach ($years as $year) {
         $country_file = dirname(__DIR__) . '/data/' . $country . '.json';
         $countryHolidays = json_decode(file_get_contents($country_file), true);
         foreach ($countryHolidays as $countryHoliday) {
             if (strstr($countryHoliday['rule'], '%Y')) {
                 $rule = str_replace('%Y', $year, $countryHoliday['rule']);
             } elseif (strstr($countryHoliday['rule'], '%EASTER')) {
                 $date = new Carbon($year . '-03-21 +' . easter_days($year) . ' days');
                 $rule = str_replace('%EASTER', $date->format('Y-m-d'), $countryHoliday['rule']);
             } elseif (in_array($country, ['BR', 'US']) && strstr($countryHoliday['rule'], '%ELECTION')) {
                 $rule = $this->calculateElectionDay($country, $years, $year, $countryHoliday);
             } else {
                 $rule = $countryHoliday['rule'] . ' ' . $year;
             }
             if ($rule) {
                 $return[] = ['name' => $countryHoliday['name'], 'date' => new Carbon($rule)];
             }
         }
     }
     return $return;
 }
Exemplo n.º 5
0
 /**
  * Check if its the birthday. Compares the date/month values of the two dates.
  *
  * @param Carbon $dt
  *
  * @return boolean
  */
 public function isBirthday(Carbon $dt)
 {
     return $this->format('md') === $dt->format('md');
 }
Exemplo n.º 6
0
 private function migrarRecaudosSolicitud()
 {
     $this->info("Migrando recaudos de la solicitud");
     $this->getTable('recaudos_solicitud')->chunk(1000, function ($recaudos) {
         foreach ($recaudos as $recaudo) {
             $this->info("Migrando recaudo de la solicitud: " . $recaudo->codrecaudo);
             $recaudoNuevo = new RecaudoSolicitud();
             $recaudoNuevo->recaudo_id = $recaudo->codrecaudo;
             $recaudoNuevo->solicitud_id = $recaudo->idsolicitud;
             $recaudoNuevo->ind_recibido = $recaudo->indrecibido == 'S';
             if ($recaudo->fecvencimiento != '') {
                 $carbon = new Carbon($recaudo->fecvencimiento);
                 $recaudoNuevo->fecha_vencimiento = $carbon->format('d/m/Y');
             }
             $recaudoNuevo->save();
         }
     });
 }
Exemplo n.º 7
0
 function formatTime(Carbon $time)
 {
     return $time->format('H:i');
 }