public function createchargesAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $config = new PAP_Helper_Config();
     $lastPeriod = $config->getLastPeriod();
     //$lastPeriod = "2MAR13";
     $currentPeriod = $this->getCurrentPeriodCode();
     //$currentPeriod = "1ABR13";
     if ($lastPeriod != $currentPeriod) {
         if ($lastPeriod != "") {
             $payments = null;
             $promos = PAP_Model_Promotion::getPromotionsByPeriod($lastPeriod);
             $period = new PAP_Model_Period();
             $period->loadByCode($lastPeriod);
             $periods = array();
             $periods[] = $period;
             $payments = PAP_Model_Payment::getAllPayments($periods);
             foreach ($payments as $payment) {
                 $charge = new PAP_Model_Charge();
                 $charge->setAmount($payment["total"])->setDiscount(0)->setPeriod($payment["periodo"])->setStatus('N')->setUserId($payment["user_id"])->setFinalAmount($payment["total"]);
                 if ($payment["total"] == "0.00") {
                     $charge->setStatus('A');
                 }
                 $charge->save();
             }
         }
         $config->setLastPeriod($currentPeriod);
     }
 }