$nfs_average = 0;
$creditcard = 0;
$creditcard_t = '';
$creditcard_average = '';
$email = '';
$emails = '';
$tutorial = '';
//Objects
$filter = new Filter();
$lender = new Lender();
$business = new Business();
$merchant = new Merchant();
$emailobj = new Email();
if (isset($_GET['id_merchant'])) {
    $id_merchant = $_GET['id_merchant'];
    $merchant->Merchant($id_merchant);
    $filter->Filter($_GET['id_merchant']);
    $type_business = $filter->getBusiness();
    $foreclosure = $filter->getForeclosure();
    $landlord = $filter->getLandlord();
    $years = $filter->getYears();
    $months = $filter->getMonths();
    $total_months = $filter->getTotalMonths();
    $bankstatements = $filter->getBankStatements();
    $bank_average = $filter->getBankAverage();
    $nfs_average = $filter->getNSF();
    $creditcard = $filter->getCreditCard();
    $creditcard_t = $filter->getCreditCard_T();
    $creditcard_average = $filter->getCreditCardAverage();
    $email = $filter->getEmail();
    // obtenemos parametros
$id_merchant = '';
$lead = '';
$name = '';
//Objects
$merchant = new Merchant();
$filter = new Filter();
if (isset($_POST['id_merchant']) && !is_numeric($_POST['id_merchant'])) {
    $merchant->setLead($_POST['lead']);
    $merchant->setName($_POST['name']);
    $merchant->insertMerchant();
    $lastmerchant = $merchant->getIDMerchant();
    $filter->setIdMerchant($lastmerchant);
    $filter->insertFilter();
}
if (isset($_GET['edit'])) {
    $merchant->Merchant($_GET['edit']);
    $id_merchant = $merchant->getIDMerchant();
    $lead = $merchant->getLead();
    $name = $merchant->getName();
}
if (isset($_POST['id_merchant']) && is_numeric($_POST['id_merchant'])) {
    $merchant->setLead($_POST['lead']);
    $merchant->setName($_POST['name']);
    $merchant->updateMerchant();
    header('Location: index.php');
}
if (isset($_GET['delete'])) {
    $merchant->Merchant($_GET['delete']);
    $merchant->deleteMerchant();
}
?>