function __construct($parent, &$company) { parent::__construct($parent, wxID_ANY, wxDefaultPosition, new wxSize(500, 300), wxTAB_TRAVERSAL); $this->listItems->InsertColumn(0, _("Customer Name"), wxLIST_FORMAT_LEFT, 200); $this->listItems->InsertColumn(1, _("Balance Total"), wxLIST_FORMAT_LEFT, 200); $this->listItems->InsertColumn(2, _("Notes"), wxLIST_FORMAT_LEFT, 400); Customer::SetCompanyDB($company); $this->customers = Customer::CustomersList(); $index = 0; foreach ($this->customers as $customer_data) { $this->listItems->InsertItem($index, $customer_data["customer_name"]); $this->listItems->SetItem($index, 1, "\$" . number_format(floatval($customer_data["opening_balance"]), 2, ".", ",")); $this->listItems->SetItem($index, 2, $customer_data["notes"]); $index++; } $this->listItems->Connect(wxEVT_COMMAND_LIST_ITEM_SELECTED, array($this, "onCustomerSelected")); $this->listItems->Connect(wxEVT_LEFT_DCLICK, array($this, "onListLeftDoubleClick")); $this->btnNew->Connect(wxEVT_COMMAND_BUTTON_CLICKED, array($this, "onNewClick")); $this->btnEdit->Connect(wxEVT_COMMAND_BUTTON_CLICKED, array($this, "onEditClick")); $this->btnDelete->Connect(wxEVT_COMMAND_BUTTON_CLICKED, array($this, "onDeleteClick")); }
function SaveChanges() { //Main customer info $data["customer_name"] = $this->txtCustomerName->GetValue(); $data["opening_balance"] = $this->txtOpeningBalance->GetValue(); $data["opening_balance_date"] = strtotime(date("n/j/Y", $this->dpOpeningBalance->GetValue()), time()); $data["company_name"] = $this->txtCompanyName->GetValue(); $data["title"] = $this->txtTitle->GetValue(); $data["first_name"] = $this->txtFirstName->GetValue(); $data["middle_name"] = $this->txtMiddleName->GetValue(); $data["last_name"] = $this->txtLastName->GetValue(); $data["contact"] = $this->txtContact->GetValue(); $data["phone"] = $this->txtPhone->GetValue(); $data["fax"] = $this->txtFax->GetValue(); $data["alt_phone"] = $this->txtAltPhone->GetValue(); $data["alt_contact"] = $this->txtAltContact->GetValue(); $data["email"] = $this->txtEmail->GetValue(); $data["cc"] = $this->txtCc->GetValue(); $data["billing_address"] = $this->txtBillTo->GetValue(); $data["shipping_address"] = $this->txtShipTo->GetValue(); //Additional info $data["terms"] = $this->cboxTerms->GetValue(); //Preferred Payment Method $data["payment_type"] = $this->cboxPaymentMethod->GetValue(); $data["cc_number"] = $this->txtCCNumber->GetValue(); $data["cc_expiration_month"] = $this->txtCCExpirationMonth->GetValue(); $data["cc_expiration_year"] = $this->txtCCExpirationYear->GetValue(); $data["cc_name_on_card"] = $this->txtCCNameOnCard->GetValue(); $data["cc_address"] = $this->txtCCAddress->GetValue(); $data["cc_zipcode"] = $this->txtCCZipCode->GetValue(); //Notes $data["notes"] = $this->txtNotes->GetValue(); Customer::SetCompanyDB($this->mainFrame->company); Customer::Add($data); if (isset($this->mainFrame->customersList)) { $this->mainFrame->customersList->ReloadList(); } }