<?php
/**
 * Created by PhpStorm.
 * User: Özgür
 * Date: 25.11.2015
 * Time: 13:11
 * TP_Mutabakat_Ozet
 */
class TP_Mutabakat_Ozet{
    function TP_Mutabakat_Ozet($guid, $baslangic, $bitis)
    {
        $this->GUID = $guid;
        $this->Tarih_Bas = $baslangic;
        $this->Tarih_Bit = $bitis;
        $this->G = new G(10738, "test" , "test");
    }
}
class G {
    function G($cc,$cu,$cp)
    {
        $this->CLIENT_CODE = $cc;
        $this->CLIENT_USERNAME = $cu;
        $this->CLIENT_PASSWORD = $cp;
    }
}
if($_POST):
    $Bagla 	= new SoapClient("https://dmzws.ew.com.tr/turkpos.ws/service_turkpos_test.asmx?wsdl");
    $nesne 	= new TP_Mutabakat_Ozet($_POST['guid'], $_POST['baslangic'], $_POST['bitis']);
    $Veri 	= $Bagla->TP_Mutabakat_Ozet($nesne);
    $q1 = $Veri->TP_Mutabakat_OzetResult;
    $DT_Bilgi = $q1->{'DT_Bilgi'};
    $Sonuc = $q1->{'Sonuc'};
    $Sonuc_Str = $q1->{'Sonuc_Str'};
    $xml = $DT_Bilgi->{'any'};
    $xmlstr = <<<XML
<?xml version='1.0' standalone='yes'?>
<root>
{$xml}
</root>
XML;
    $xmlstr    = str_replace(array("diffgr:","msdata:"),'', $xmlstr);
    $data = simplexml_load_string($xmlstr);
    $liste = $data->diffgram->NewDataSet;
    foreach ($liste->DT_Mutabakat_Ozet as $islem):
        echo "<br/>";
        echo "Odeme_Sonuc: {$islem->Odeme_Sonuc}"."<br/>";
        echo "Odeme_Sonuc_Aciklama: {$islem->Odeme_Sonuc_Aciklama}"."<br/>";
        echo "Tarih: {$islem->Tarih}"."<br/>";
        echo "Dekont_ID: {$islem->Dekont_ID}"."<br/>";
        echo "Siparis_ID: {$islem->Siparis_ID}"."<br/>";
        echo "Islem_ID: {$islem->Islem_ID}"."<br/>";
        echo "Komisyon_Oran: {$islem->Komisyon_Oran}"."<br/>";
        echo "Komisyon_Tutar: {$islem->Komisyon_Tutar}"."<br/>";
        echo "Toplam_Tutar: {$islem->Toplam_Tutar}"."<br/>";
        echo "Taksit: {$islem->Taksit}"."<br/>";
    endforeach;
endif;
?>
<style>
    .clearfx {
        clear: both;
    }
    .body {
        margin: 0 auto;
        padding: 50px 100px;
    }
    .center-align {
        text-align: center;
        margin: 0 auto;
    }
    .divbox {
        display: inline-block;
    }
    .text-input {
        width: 50%;
    }
    .submit-class {
        width="70%";
        height="30px";
    }
</style>
<form action="mutabakatozet.php" method="post" enctype="multipart/form-data" >
    <section role="form" class="section-form">
        <legend class="center-align">
            <h3>TP_Mutabakat_Ozet Metodu</h3>
        </legend>
        <hr />
        <div class="center-align">
            <label for="">Üye İşyerine ait Anahtar:</label>
            <input type="text" class="text-input" name="guid" />
        </div>
        <hr />
        <div class="center-align">
            <label for="">Başlangıç Tarihi:</label>
            <input type="datetime" class="text-input" name="baslangic" />
        </div>
        <hr />
        <div class="center-align">
            <label for="">Bitiş Tarihi:</label>
            <input type="datetime" class="text-input" name="bitis" />
        </div>
        <hr />
        <div class="center-align">
            <input class="Submit" type="submit" name="submit" id="submit" value="Özet Al" />
        </div>
    </section>
    <div class="clearfx"></div>
</form>
