Example #1
0
 private function load()
 {
     $this->firstDate = str_replace("/", "-", $this->getFirstDate());
     if (strlen($this->firstDate) == 8) {
         // fecha con year en formato corto
         list($mm, $dd, $yy) = split("-", $this->firstDate);
         $this->firstDate = "{$dd}-{$mm}-20{$yy}";
         $time = strtotime($this->firstDate);
         $this->firstDate = date("d/m/Y", $time);
     }
     $this->lastDate = str_replace("/", "-", $this->getLastDate());
     if (strlen($this->lastDate) == 8) {
         // fecha con year en formato corto
         list($mm, $dd, $yy) = split("-", $this->lastDate);
         $this->lastDate = "{$dd}-{$mm}-20{$yy}";
         $time = strtotime($this->lastDate);
         $this->lastDate = date("d/m/Y", $time);
         $mmCotizacion = $mm;
         $yyCotizacion = "20" . $yy;
     }
     $this->totalAmount = number_format($this->getTotalSales() * bob2usd(PRECIO, $mmCotizacion, $yyCotizacion), 2);
     $this->totalDetails = $this->getTotalDetails();
     $this->dateReport = str_replace("/", "-", $this->getDateReport());
     $time = strtotime($this->dateReport);
     $this->dateReport = date("d/m/Y", $time);
     //		list ($dd,$mm,$yyyy) = split("/", $this->dateReport);
     $this->update();
 }
Example #2
0
 private function load()
 {
     $this->firstDate = str_replace("/", "-", $this->getFirstDate());
     if (strlen($this->firstDate) == 8) {
         // fecha con year en formato corto
         list($mm, $dd, $yy) = split("-", $this->firstDate);
         $this->firstDate = "{$dd}-{$mm}-20{$yy}";
         $time = strtotime($this->firstDate);
         $this->firstDate = date("d/m/Y", $time);
     }
     $this->lastDate = str_replace("/", "-", $this->getLastDate());
     if (strlen($this->lastDate) == 8) {
         // fecha con year en formato corto
         list($mm, $dd, $yy) = split("-", $this->lastDate);
         $this->lastDate = "{$dd}-{$mm}-20{$yy}";
         $time = strtotime($this->lastDate);
         $this->lastDate = date("d/m/Y", $time);
         $mmCotizacion = $mm;
         $yyCotizacion = "20" . $yy;
     }
     $this->totalDetails = $this->getTotalDetails();
     $this->dateReport = str_replace("/", "-", $this->getDateReport());
     $time = strtotime($this->dateReport);
     $this->dateReport = date("d/m/Y", $time);
     list($dd, $mm, $yyyy) = split("/", $this->dateReport);
     $sql = "SELECT id,idWarner,nombre,autor,comprar,regalar,descargar FROM admins.warner_detail_tones WHERE reportId='{$this->reportId}' ";
     $rs = mysql_query($sql, $this->dbc->db);
     if (!$rs) {
         // error querying db
         echo "error db ({$sql}):" . mysql_error($this->dbc) . "";
     }
     while ($obj = mysql_fetch_object($rs)) {
         $this->operationType = $this->getOperationType();
         $this->saleType = $this->getSaleType();
         $this->distributionChannel = $this->getDistributionChannel();
         $this->originalProductCode = "";
         $this->artist = $obj->autor;
         $this->title = $obj->nombre;
         $this->productCode = $this->getGridCode();
         if ($this->productCode == "") {
             $this->productCode = getGrid($this->title);
         }
         //			if ($this->productCode == "") echo "$this->title\n";
         $this->totalSoldUnits = $obj->comprar;
         $precio_sin_impuestos = PRECIO - PRECIO * 0.18;
         $this->priceClient = number_format(bob2usd($precio_sin_impuestos, $mmCotizacion, $yyCotizacion), 4);
         $precio_warner_sin_impuestos = $precio_sin_impuestos * 0.5;
         $this->priceDSPMSP = number_format(bob2usd($precio_warner_sin_impuestos, $mmCotizacion, $yyCotizacion), 4);
         $this->aditionalIncome = 0;
         $this->revenue = 0;
         // warner revenue, 50%
         $this->chargingEntity = $this->DSPMSP;
         $this->DSPMSPName = "Wazzup";
         $this->DSPMSPCountry = "UY";
         $this->clientCountry = "BO";
         $this->priceLevel = "STD";
         $this->currencyCode = "USD";
         $this->save();
         $string = $this->DSPMSP . "\t" . $this->dateReport . "\t" . $this->firstDate . "\t" . $this->lastDate . "\t" . $this->operationType . "\t" . $this->saleType . "\t" . $this->distributionChannel . "\t" . $this->originalProductCode . "\t" . $this->productCode . "\t" . $this->artist . "\t" . $this->title . "\t" . $this->totalSoldUnits . "\t" . $this->priceClient . "\t" . $this->priceDSPMSP . "\t" . $this->aditionalIncome . "\t" . $this->revenue . "\t" . $this->chargingEntity . "\t" . $this->DSPMSPName . "\t" . $this->DSPMSPCountry . "\t" . $this->clientCountry . "\t" . $this->priceLevel . "\t" . $this->currencyCode . "\n";
         $this->detailDIP .= $string;
     }
 }