Clomosy | Forum Ana Sayfa
Forum Anasayfa Forum Anasayfa > Genel Programlama > Genel İşlemler
  Aktif Konular Aktif Konular RSS - FATURA OLUŞTUR / DÜZENLE  ILK GELEMESI LAZIM
  SSS SSS  Forumu Ara   Etkinlikler   Kayıt Ol Kayıt Ol  Giriş Giriş

Clomosy Resmi Forum Sitesidir. Amacımız kullanıcılarımıza, iş ortaklarımıza, danışmanlara, yazılımcılara programlarımız hakkında destek ve bilgi vermektir.

FATURA OLUŞTUR / DÜZENLE ILK GELEMESI LAZIM

 Yanıt Yaz Yanıt Yaz
Yazar
Mesaj
  Konu Arama Konu Arama  Topic Seçenekleri Topic Seçenekleri
Barthe_dev Açılır Kutu İzle
Yeni Üye
Yeni Üye


Kayıt Tarihi: 07 Temmuz 2026
Konum: konya
Durum: Aktif Değil
Puanlar: 33
Mesaj Seçenekleri Mesaj Seçenekleri   Teşekkürler (0) Teşekkürler(0)   Alıntı Barthe_dev Alıntı  Yanıt YazCevapla Mesajın Direkt Linki Konu: FATURA OLUŞTUR / DÜZENLE ILK GELEMESI LAZIM
    Gönderim Zamanı: 3 Saat 35 Dakika Önce Saat 14:55
var
  SecretaryForm: TclForm;
  mainLayout, headerLayout, switcherLayout: TclLayout;
  scrollBody, pendingScrollBox, historyScrollBox, stockScrollBox: TclVertScrollBox;
  
  // Header
  lblKicker, lblTitle: TclProLabel;
  btnSwitchInvoice, btnSwitchStock: TclProButton;
  
  // Formulaire de saisie dynamique
  formInvoicePanel: TclProPanel;
  lblFormTitle: TclProLabel;
  rowClientInput: TclLayout; // 💡 Ligne horizontale pour Edt + Bouton
  edtClient, edtEmail, edtPhone, edtAddress, edtNotes, edtQty, edtProductId: TclProEdit;
  btnSubmitInvoice, btnCancelEdit, btnOpenAddClient, btnOpenEditClient, btnSelectClientForm: TclProButton;
  editingInvoiceId: Integer;
  
  // Pop-up Modal "Müşteri Seç"
  ModalSelectClientOverlay: TclLayout;
  ModalSelectClientCard: TclProPanel;
  ModalSelectClientTitle: TclProLabel;
  CmbClientListModal: TclComboBox;
  BtnModalConfirmSelectClient, BtnModalCancelSelectClient: TclProButton;
  ModalSelectClientButtonsLayout: TclLayout;
  
  // Pop-up Modal Müşteri Ekle (Nouveau Client)
  ModalClientOverlay: TclLayout;
  ModalClientCard: TclProPanel;
  ModalClientTitle: TclProLabel;
  EdtClientNameModal, EdtClientEmailModal, EdtClientPhoneModal, EdtClientAddressModal: TclProEdit;
  BtnModalSaveClient, BtnModalCancelClient: TclProButton;
  ModalClientButtonsLayout: TclLayout;

  // Pop-up Modal Müşteri Bilgisi Değiştir (Modifier Client)
  ModalEditClientOverlay: TclLayout;
  ModalEditClientCard: TclProPanel;
  ModalEditClientTitle: TclProLabel;
  CmbClientSelect: TclComboBox;
  EdtEditClientEmailModal, EdtEditClientPhoneModal, EdtEditClientAddressModal: TclProEdit;
  BtnModalSaveEditClient, BtnModalCancelEditClient: TclProButton;
  ModalEditClientButtonsLayout: TclLayout;
  clientsDataSet, formClientsDataSet: TclJsonQuery;
  
  // Sections
  pendingPanel, historyPanel, stockPanel, tabBarPanel: TclProPanel;
  stockHeaderLayout: TclLayout;
  lblPendingTitle, lblHistoryTitle, lblStockTitle: TclProLabel;
  edtSearchStock: TclProEdit;
  btnTabInvoices, btnTabStockView, btnTabReports: TclProButton;
  
  // Réseau & Variables
  Unitnavigate: TclUnit;
  restApi: TclRest;
  responseStr, pendingStr, historyStr, stockStr, uniqID, filterKeyword: String; 
  rootObj: TclJsonObject;
  pendingArr, historyArr, stockArr: TclJsonQuery;
  pCount, hCount, sCount, cardCounter: Integer;
  
  // UI composants temporaires
  tempCard: TclProPanel;
  tempLayout, tempActionsLayout: TclLayout;
  tempLabel, tempLabel2: TclProLabel;
  btnAddProd, btnActionVal, btnActionEdit, btnActionDel, btnSelectProd: TclProButton;

// ============================================================
// CHARGEMENT ET SÉLECTION DU CLIENT DEPUIS LE MODAL "MÜŞTERİ SEÇ"
// ============================================================
void OpenSelectClientFormModal;
var
  clientsJson: String;
{
  CmbClientListModal.Clear;

  restApi = TclRest.Create;
  try
    restApi.Method = rmGET;
    restApi.Accept = 'application/json';
    restApi.ConnectTimeOut = 15000;
    restApi.Execute;

    responseStr = restApi.Response;

    if ((responseStr <> '') && (Copy(responseStr, 1, 1) == '{')) 
    {
      rootObj = TCLJSON.ParseToJSONObject(responseStr);
      if ((rootObj <> nil) && rootObj.HasKey('success') && rootObj.GetValue('success').AsBoolean) 
      {
        clientsJson = rootObj.GetValue('clients_json').AsString;
        if ((clientsJson <> '') && (clientsJson <> '[]')) 
        {
          formClientsDataSet = Clomosy.ClDataSetFromJSON(clientsJson);
          if (formClientsDataSet <> nil) 
          {
            formClientsDataSet.First;
            while (not formClientsDataSet.Eof) 
            {
              CmbClientListModal.AddItem(formClientsDataSet.FieldByName('client_name').AsString, formClientsDataSet.FieldByName('id').AsString);
              formClientsDataSet.Next;
            }
          }
        }
      }
    }
  finally
  }

  ModalSelectClientOverlay.Visible = True;
}

void CloseSelectClientFormModal;
{
  ModalSelectClientOverlay.Visible = False;
}

void ConfirmSelectClientFromModal;
var
  selectedName: String;
{
  selectedName = CmbClientListModal.Text;
  if ((selectedName <> '') && (formClientsDataSet <> nil)) 
  {
    formClientsDataSet.First;
    while (not formClientsDataSet.Eof) 
    {
      if (formClientsDataSet.FieldByName('client_name').AsString == selectedName) 
      {
        edtClient.Text = formClientsDataSet.FieldByName('client_name').AsString;
        edtAddress.Text = formClientsDataSet.FieldByName('address').AsString;
        edtEmail.Text = formClientsDataSet.FieldByName('email').AsString;
        edtPhone.Text = formClientsDataSet.FieldByName('phone').AsString;
        Break;
      }
      formClientsDataSet.Next;
    }
  }
  CloseSelectClientFormModal;
}

// ============================================================
// GESTION POPUP MODAL NOUVEAU CLIENT
// ============================================================
void OpenAddClientModal;
{
  EdtClientNameModal.Text = '';
  EdtClientEmailModal.Text = '';
  EdtClientPhoneModal.Text = '';
  EdtClientAddressModal.Text = '';
  ModalClientOverlay.Visible = True;
}

void CloseAddClientModal;
{
  ModalClientOverlay.Visible = False;
}

void SaveNewClient;
var
  payloadJson, newName, newAddr: String;
{
  newName = Trim(EdtClientNameModal.Text);
  newAddr = Trim(EdtClientAddressModal.Text);

  if (newName == '') 
  {
    ShowMessage('⚠️ Lütfen Müşteri Adını girin.');
    Exit;
  }

  payloadJson = '{"client_name":"' + newName + '",' +
                 '"email":"' + EdtClientEmailModal.Text + '",' +
                 '"phone":"' + EdtClientPhoneModal.Text + '",' +
                 '"address":"' + newAddr + '"}';

  restApi = TclRest.Create;
  try
    restApi.Method = rmPOST;
    restApi.Accept = 'application/json';
    restApi.AddBody(payloadJson, 'application/json');
    restApi.Execute;

    responseStr = restApi.Response;

    if ((responseStr <> '') && (Copy(responseStr, 1, 1) == '{')) 
    {
      rootObj = TCLJSON.ParseToJSONObject(responseStr);
      if ((rootObj <> nil) && rootObj.HasKey('success') && rootObj.GetValue('success').AsBoolean) 
      {
        ShowMessage('✅ ' + rootObj.GetValue('message').AsString);
        
        edtClient.Text = newName;
        edtAddress.Text = newAddr;
        edtEmail.Text = EdtClientEmailModal.Text;
        edtPhone.Text = EdtClientPhoneModal.Text;
        
        CloseAddClientModal;
      }
      else
      {
        if ((rootObj <> nil) && rootObj.HasKey('message')) {
          ShowMessage('❌ ' + rootObj.GetValue('message').AsString);
        }
      }
    }
  finally
  }
}

// ============================================================
// GESTION POPUP MODAL MODIFICATION CLIENT
// ============================================================
void CloseEditClientModal;
{
  ModalEditClientOverlay.Visible = False;
}

void OnClientSelectedFromCombo;
var
  selectedName: String;
{
  selectedName = CmbClientSelect.Text;
  if ((selectedName == '') || (clientsDataSet == nil)) Exit;

  clientsDataSet.First;
  while (not clientsDataSet.Eof) 
  {
    if (clientsDataSet.FieldByName('client_name').AsString == selectedName) 
    {
      EdtEditClientEmailModal.Text = clientsDataSet.FieldByName('email').AsString;
      EdtEditClientPhoneModal.Text = clientsDataSet.FieldByName('phone').AsString;
      EdtEditClientAddressModal.Text = clientsDataSet.FieldByName('address').AsString;
      Exit;
    }
    clientsDataSet.Next;
  }
}

void OpenEditClientModal;
var
  clientsJson: String;
{
  CmbClientSelect.Clear;
  EdtEditClientEmailModal.Text = '';
  EdtEditClientPhoneModal.Text = '';
  EdtEditClientAddressModal.Text = '';

  restApi = TclRest.Create;
  try
    restApi.Method = rmGET;
    restApi.Accept = 'application/json';
    restApi.ConnectTimeOut = 15000;
    restApi.Execute;

    responseStr = restApi.Response;

    if ((responseStr <> '') && (Copy(responseStr, 1, 1) == '{')) 
    {
      rootObj = TCLJSON.ParseToJSONObject(responseStr);
      if ((rootObj <> nil) && rootObj.HasKey('success') && rootObj.GetValue('success').AsBoolean) 
      {
        clientsJson = rootObj.GetValue('clients_json').AsString;
        if ((clientsJson <> '') && (clientsJson <> '[]')) 
        {
          clientsDataSet = Clomosy.ClDataSetFromJSON(clientsJson);
          if (clientsDataSet <> nil) 
          {
            clientsDataSet.First;
            while (not clientsDataSet.Eof) 
            {
              CmbClientSelect.AddItem(clientsDataSet.FieldByName('client_name').AsString, clientsDataSet.FieldByName('id').AsString);
              clientsDataSet.Next;
            }
            if (CmbClientSelect.ItemIndex >= 0) 
            {
              OnClientSelectedFromCombo;
            }
          }
        }
      }
    }
  finally
  }

  ModalEditClientOverlay.Visible = True;
}

void SaveEditedClient;
var
  payloadJson, selectedName: String;
{
  selectedName = CmbClientSelect.Text;

  if (selectedName == '') 
  {
    ShowMessage('⚠️ Lütfen bir müşteri seçin.');
    Exit;
  }

  payloadJson = '{"client_name":"' + selectedName + '",' +
                 '"email":"' + EdtEditClientEmailModal.Text + '",' +
                 '"phone":"' + EdtEditClientPhoneModal.Text + '",' +
                 '"address":"' + EdtEditClientAddressModal.Text + '"}';

  restApi = TclRest.Create;
  try
    restApi.Method = rmPOST;
    restApi.Accept = 'application/json';
    restApi.AddBody(payloadJson, 'application/json');
    restApi.Execute;

    responseStr = restApi.Response;

    if ((responseStr <> '') && (Copy(responseStr, 1, 1) == '{')) 
    {
      rootObj = TCLJSON.ParseToJSONObject(responseStr);
      if ((rootObj <> nil) && rootObj.HasKey('success') && rootObj.GetValue('success').AsBoolean) 
      {
        ShowMessage('✅ ' + rootObj.GetValue('message').AsString);
        
        edtClient.Text = selectedName;
        edtAddress.Text = EdtEditClientAddressModal.Text;
        edtEmail.Text = EdtEditClientEmailModal.Text;
        edtPhone.Text = EdtEditClientPhoneModal.Text;
        
        CloseEditClientModal;
      }
      else
      {
        if ((rootObj <> nil) && rootObj.HasKey('message')) {
          ShowMessage('❌ ' + rootObj.GetValue('message').AsString);
        }
      }
    }
  finally
  }
}

// ============================================================
// CHARGEMENT ET FILTRAGE DU STOCK DYNAMIQUE
// ============================================================
void LoadStockData;
var
  stQty: Integer;
  prodName, prodIdStr: String;
{
  stockArr = nil;
  filterKeyword = UpperCase(Trim(edtSearchStock.Text));

  if (stockScrollBox <> nil) 
  { 
    stockScrollBox.Free; 
    stockScrollBox = nil; 
  }
  stockScrollBox = SecretaryForm.AddNewVertScrollBox(stockPanel, 'stockScrollBox');
  stockScrollBox.Align = alClient; 
  stockScrollBox.Margins.Left = 8; 
  stockScrollBox.Margins.Right = 8;

  restApi = TclRest.Create;
  try
    restApi.Method = rmGET;
    restApi.Accept = 'application/json';
    restApi.ConnectTimeOut = 15000;
    restApi.Execute;

    responseStr = restApi.Response;

    if ((responseStr <> '') && (Copy(responseStr, 1, 1) == '{')) 
    {
      rootObj = TCLJSON.ParseToJSONObject(responseStr);

      if ((rootObj <> nil) && rootObj.HasKey('success') && rootObj.GetValue('success').AsBoolean) 
      {
        if (rootObj.HasKey('stock_count')) 
        {
          sCount = StrToInt(rootObj.GetValue('stock_count').AsString);
          if (sCount > 0) 
          {
            stockStr = rootObj.GetValue('stock_json').AsString;
            if ((stockStr <> '') && (stockStr <> '[]')) 
            {
              stockArr = Clomosy.ClDataSetFromJSON(stockStr);
              if (stockArr <> nil) 
              {
                stockArr.First;
                cardCounter = 0;
                while (not stockArr.Eof) 
                {
                  prodName = stockArr.FieldByName('product_name').AsString;
                  prodIdStr = stockArr.FieldByName('id').AsString;

                  if ((filterKeyword == '') || 
                      (Pos(filterKeyword, UpperCase(prodName)) > 0) || 
                      (Pos(filterKeyword, prodIdStr) > 0)) 
                  {
                    cardCounter = cardCounter + 1;
                    uniqID = prodIdStr + '_' + IntToStr(cardCounter);

                    tempCard = SecretaryForm.AddNewProPanel(stockScrollBox, 'stCard_' + uniqID);
                    tempCard.Align = alTop; 
                    tempCard.Height = 65; 
                    tempCard.Margins.Bottom = 6;
                    clComponent.SetupComponent(tempCard, '{"BackgroundColor":"#080d14", "RoundHeight":8, "RoundWidth":8, "BorderColor":"#1a2d42", "BorderWidth":1}');

                    tempLayout = SecretaryForm.AddNewLayout(tempCard, 'stTxt_' + uniqID);
                    tempLayout.Align = alClient; 
                    tempLayout.Margins.Left = 10; 
                    tempLayout.Margins.Top = 6;

                    tempLabel = SecretaryForm.AddNewProLabel(tempLayout, 'stLblT_' + uniqID, 'ID #' + prodIdStr + ' · ' + prodName);
                    tempLabel.Align = alTop; 
                    tempLabel.clProSettings.FontSize = 11;
                    tempLabel.clProSettings.FontColor = clAlphaColor.clHexToColor('#e2eaf5');
                    tempLabel.clProSettings.TextSettings.Font.Style = [fsBold];
                    tempLabel.SetclProSettings(tempLabel.clProSettings);

                    stQty = StrToIntDef(stockArr.FieldByName('stock_quantity').AsString, 0);
                    tempLabel2 = SecretaryForm.AddNewProLabel(tempLayout, 'stLblS_' + uniqID, 'Fiyat : ' + stockArr.FieldByName('unit_price').AsString + ' DA  |  Stokta : ' + IntToStr(stQty) + ' adet');
                    tempLabel2.Align = alTop; 
                    tempLabel2.clProSettings.FontSize = 10;

                    if (stQty <= 20) 
                      tempLabel2.clProSettings.FontColor = clAlphaColor.clHexToColor('#f87171')
                    else
                      tempLabel2.clProSettings.FontColor = clAlphaColor.clHexToColor('#4ade80');

                    tempLabel2.Margins.Top = 3; 
                    tempLabel2.SetclProSettings(tempLabel2.clProSettings);

                    btnSelectProd = SecretaryForm.AddNewProButton(tempCard, 'btnSelP_' + uniqID, 'Seç');
                    btnSelectProd.Align = alRight; 
                    btnSelectProd.Width = 90; 
                    btnSelectProd.Margins.Right = 8; 
                    btnSelectProd.Margins.Top = 14; 
                    btnSelectProd.Margins.Bottom = 14;
                    btnSelectProd.Hint = prodIdStr;
                    clComponent.SetupComponent(btnSelectProd, '{"BackgroundColor":"#00d4ff20", "TextColor":"#ede9e9", "RoundHeight":6, "RoundWidth":6, "BorderColor":"#00d4ff50", "BorderWidth":1}');
                    SecretaryForm.AddNewEvent(btnSelectProd, tbeOnClick, 'OnSelectProductFromStock');
                  }

                  stockArr.Next;
                }
              }
            }
          }
        }
      }
    }
  finally
  }
}

void OnSearchStockChange;
{
  LoadStockData;
}

// ============================================================
// BASCULE DE VUE DYNAMIQUE
// ============================================================
void ShowInvoiceSection;
{
  formInvoicePanel.Visible = True;
  pendingPanel.Visible = True;
  historyPanel.Visible = True;
  stockPanel.Visible = False;

  clComponent.SetupComponent(btnSwitchInvoice, '{"BackgroundColor":"#0d1520", "TextColor":"#00d4ff", "RoundHeight":10, "RoundWidth":10, "BorderColor":"#00d4ff40", "BorderWidth":1}');
  clComponent.SetupComponent(btnSwitchStock, '{"BackgroundColor":"#080d14", "TextColor":"#4a6580", "RoundHeight":10, "RoundWidth":10, "BorderColor":"#1a2d42", "BorderWidth":1}');

  clComponent.SetupComponent(btnTabInvoices, '{"BackgroundColor":"#07101c", "TextColor":"#00d4ff", "RoundHeight":0, "RoundWidth":0}');
  clComponent.SetupComponent(btnTabStockView, '{"BackgroundColor":"#07101c", "TextColor":"#4a6580", "RoundHeight":0, "RoundWidth":0}');
}

void ShowStockSection;
{
  formInvoicePanel.Visible = False;
  pendingPanel.Visible = False;
  historyPanel.Visible = False;
  stockPanel.Visible = True;

  clComponent.SetupComponent(btnSwitchInvoice, '{"BackgroundColor":"#080d14", "TextColor":"#4a6580", "RoundHeight":10, "RoundWidth":10, "BorderColor":"#1a2d42", "BorderWidth":1}');
  clComponent.SetupComponent(btnSwitchStock, '{"BackgroundColor":"#0d1520", "TextColor":"#00d4ff", "RoundHeight":10, "RoundWidth":10, "BorderColor":"#00d4ff40", "BorderWidth":1}');

  clComponent.SetupComponent(btnTabInvoices, '{"BackgroundColor":"#07101c", "TextColor":"#4a6580", "RoundHeight":0, "RoundWidth":0}');
  clComponent.SetupComponent(btnTabStockView, '{"BackgroundColor":"#07101c", "TextColor":"#00d4ff", "RoundHeight":0, "RoundWidth":0}');

  LoadStockData;
}

void OnSelectProductFromStock;
var
  btnSender: TclProButton;
{
  btnSender = TclProButton(SecretaryForm.ClSender);
  edtProductId.Text = btnSender.Hint;
  ShowInvoiceSection;
  ShowMessage('💡 Ürün ID #' + btnSender.Hint + ' seçildi!');
}

void CancelEdit;
{
  edtClient.Text = ''; edtAddress.Text = ''; edtEmail.Text = ''; edtPhone.Text = ''; edtNotes.Text = ''; edtQty.Text = ''; edtProductId.Text = '';
  editingInvoiceId = 0;
  btnSubmitInvoice.Caption = 'Faturayı Oluştur';
  btnCancelEdit.Visible = False;
}

// ============================================================
// CHARGEMENT DES FACTURES
// ============================================================
void LoadInvoicesData;
var
  prodSummary: String;
{
  pendingArr = nil; 
  historyArr = nil;

  if (pendingScrollBox <> nil) 
  { 
    pendingScrollBox.Free; 
    pendingScrollBox = nil; 
  }
  pendingScrollBox = SecretaryForm.AddNewVertScrollBox(pendingPanel, 'pendingScrollBox');
  pendingScrollBox.Align = alClient; 
  pendingScrollBox.Margins.Left = 8; 
  pendingScrollBox.Margins.Right = 8;

  if (historyScrollBox <> nil) 
  { 
    historyScrollBox.Free; 
    historyScrollBox = nil; 
  }
  historyScrollBox = SecretaryForm.AddNewVertScrollBox(historyPanel, 'historyScrollBox');
  historyScrollBox.Align = alClient; 
  historyScrollBox.Margins.Left = 8; 
  historyScrollBox.Margins.Right = 8;

  restApi = TclRest.Create;
  try
    restApi.Method = rmGET;
    restApi.Accept = 'application/json';
    restApi.ConnectTimeOut = 15000;
    restApi.Execute;

    responseStr = restApi.Response;

    if ((responseStr <> '') && (Copy(responseStr, 1, 1) == '{')) 
    {
      rootObj = TCLJSON.ParseToJSONObject(responseStr);

      if ((rootObj <> nil) && rootObj.HasKey('success') && rootObj.GetValue('success').AsBoolean) 
      {
        cardCounter = 0;

        // 1. FACTURES EN ATTENTE
        if (rootObj.HasKey('pending_count')) 
        {
          pCount = StrToInt(rootObj.GetValue('pending_count').AsString);
          if (pCount > 0) 
          {
            pendingStr = rootObj.GetValue('pending_json').AsString;
            if ((pendingStr <> '') && (pendingStr <> '[]')) 
            {
              pendingArr = Clomosy.ClDataSetFromJSON(pendingStr);
              if (pendingArr <> nil) 
              {
                pendingArr.First;
                while (not pendingArr.Eof) 
                {
                  cardCounter = cardCounter + 1;
                  uniqID = pendingArr.FieldByName('id').AsString + '_' + IntToStr(cardCounter);

                  tempCard = SecretaryForm.AddNewProPanel(pendingScrollBox, 'pCard_' + uniqID);
                  tempCard.Align = alTop; 
                  tempCard.Height = 95; 
                  tempCard.Margins.Bottom = 8;
                  clComponent.SetupComponent(tempCard, '{"BackgroundColor":"#080d14", "RoundHeight":10, "RoundWidth":10, "BorderColor":"#1a2d42", "BorderWidth":1}');

                  tempLayout = SecretaryForm.AddNewLayout(tempCard, 'pTxt_' + uniqID);
                  tempLayout.Align = alClient; 
                  tempLayout.Margins.Left = 10; 
                  tempLayout.Margins.Top = 6;

                  tempLabel = SecretaryForm.AddNewProLabel(tempLayout, 'pLblT_' + uniqID, pendingArr.FieldByName('invoice_number').AsString + ' · ' + pendingArr.FieldByName('client_name').AsString);
                  tempLabel.Align = alTop; 
                  tempLabel.clProSettings.FontSize = 12;
                  tempLabel.clProSettings.FontColor = clAlphaColor.clHexToColor('#e2eaf5');
                  tempLabel.clProSettings.TextSettings.Font.Style = [fsBold];
                  tempLabel.SetclProSettings(tempLabel.clProSettings);

                  if (pendingArr.FieldByName('products_summary') <> nil) 
                    prodSummary = pendingArr.FieldByName('products_summary').AsString
                  else
                    prodSummary = 'Ürün yok';

                  tempLabel2 = SecretaryForm.AddNewProLabel(tempLayout, 'pLblP_' + uniqID, '📦 ' + prodSummary);
                  tempLabel2.Align = alTop; 
                  tempLabel2.clProSettings.FontSize = 10;
                  tempLabel2.clProSettings.FontColor = clAlphaColor.clHexToColor('#94a3b8');
                  tempLabel2.Margins.Top = 3; 
                  tempLabel2.SetclProSettings(tempLabel2.clProSettings);

                  tempLabel2 = SecretaryForm.AddNewProLabel(tempLayout, 'pLblS_' + uniqID, 'Toplam Miktar: ' + pendingArr.FieldByName('total_qty').AsString + ' adet · Toplam: ' + pendingArr.FieldByName('total_amount').AsString + ' DA');
                  tempLabel2.Align = alTop; 
                  tempLabel2.clProSettings.FontSize = 10;
                  tempLabel2.clProSettings.FontColor = clAlphaColor.clHexToColor('#00d4ff');
                  tempLabel2.clProSettings.TextSettings.Font.Style = [fsBold];
                  tempLabel2.Margins.Top = 3; 
                  tempLabel2.SetclProSettings(tempLabel2.clProSettings);

                  tempActionsLayout = SecretaryForm.AddNewLayout(tempCard, 'pAct_' + uniqID);
                  tempActionsLayout.Align = alRight; 
                  tempActionsLayout.Width = 145; 
                  tempActionsLayout.Margins.Right = 10; 
                  tempActionsLayout.Margins.Top = 31; 
                  tempActionsLayout.Margins.Bottom = 32; 

                  btnAddProd = SecretaryForm.AddNewProButton(tempActionsLayout, 'btnAddP_' + uniqID, '➕');
                  btnAddProd.Align = alLeft; btnAddProd.Width = 32;
                  btnAddProd.Hint = pendingArr.FieldByName('id').AsString;
                  clComponent.SetupComponent(btnAddProd, '{"BackgroundColor":"#eab30820", "TextColor":"#eab308", "RoundHeight":8, "RoundWidth":8, "BorderColor":"#eab30850", "BorderWidth":1}');
                  SecretaryForm.AddNewEvent(btnAddProd, tbeOnClick, 'OnAddItemToInvoice');

                  btnActionEdit = SecretaryForm.AddNewProButton(tempActionsLayout, 'btnEdit_' + uniqID, '✏️');
                  btnActionEdit.Align = alLeft; btnActionEdit.Width = 32; btnActionEdit.Margins.Left = 5;
                  btnActionEdit.Hint = pendingArr.FieldByName('id').AsString;
                  clComponent.SetupComponent(btnActionEdit, '{"BackgroundColor":"#00d4ff20", "TextColor":"#00d4ff", "RoundHeight":8, "RoundWidth":8, "BorderColor":"#00d4ff50", "BorderWidth":1}');
                  SecretaryForm.AddNewEvent(btnActionEdit, tbeOnClick, 'OnEditInvoice');

                  btnActionDel = SecretaryForm.AddNewProButton(tempActionsLayout, 'btnDel_' + uniqID, '🗑️');
                  btnActionDel.Align = alLeft; btnActionDel.Width = 32; btnActionDel.Margins.Left = 5;
                  btnActionDel.Hint = pendingArr.FieldByName('id').AsString;
                  clComponent.SetupComponent(btnActionDel, '{"BackgroundColor":"#f8717120", "TextColor":"#f87171", "RoundHeight":8, "RoundWidth":8, "BorderColor":"#f8717150", "BorderWidth":1}');
                  SecretaryForm.AddNewEvent(btnActionDel, tbeOnClick, 'OnCancelInvoice');

                  btnActionVal = SecretaryForm.AddNewProButton(tempActionsLayout, 'btnVal_' + uniqID, '✔️');
                  btnActionVal.Align = alLeft; btnActionVal.Width = 32; btnActionVal.Margins.Left = 5;
                  btnActionVal.Hint = pendingArr.FieldByName('id').AsString;
                  clComponent.SetupComponent(btnActionVal, '{"BackgroundColor":"#22c55e20", "TextColor":"#22c55e", "RoundHeight":8, "RoundWidth":8, "BorderColor":"#22c55e50", "BorderWidth":1}');
                  SecretaryForm.AddNewEvent(btnActionVal, tbeOnClick, 'OnValidateInvoice');

                  pendingArr.Next;
                }
              }
            }
          }
        }

        // 2. HISTORIQUE DU JOUR
        if (rootObj.HasKey('history_count')) 
        {
          hCount = StrToInt(rootObj.GetValue('history_count').AsString);
          if (hCount > 0) 
          {
            historyStr = rootObj.GetValue('history_json').AsString;
            if ((historyStr <> '') && (historyStr <> '[]')) 
            {
              historyArr = Clomosy.ClDataSetFromJSON(historyStr);
              if (historyArr <> nil) 
              {
                historyArr.First;
                while (not historyArr.Eof) 
                {
                  cardCounter = cardCounter + 1;
                  uniqID = historyArr.FieldByName('id').AsString + '_' + IntToStr(cardCounter);

                  tempCard = SecretaryForm.AddNewProPanel(historyScrollBox, 'hCard_' + uniqID);
                  tempCard.Align = alTop; tempCard.Height = 58; tempCard.Margins.Bottom = 6;
                  clComponent.SetupComponent(tempCard, '{"BackgroundColor":"#080d14", "RoundHeight":8, "RoundWidth":8, "BorderColor":"#1a2d42", "BorderWidth":1}');

                  tempLayout = SecretaryForm.AddNewLayout(tempCard, 'hTxt_' + uniqID);
                  tempLayout.Align = alClient; tempLayout.Margins.Left = 10; tempLayout.Margins.Top = 6;

                  tempLabel = SecretaryForm.AddNewProLabel(tempLayout, 'hLblT_' + uniqID, historyArr.FieldByName('invoice_number').AsString + ' · ' + historyArr.FieldByName('client_name').AsString);
                  tempLabel.Align = alTop; tempLabel.clProSettings.FontSize = 11;
                  tempLabel.clProSettings.FontColor = clAlphaColor.clHexToColor('#e2eaf5');
                  tempLabel.SetclProSettings(tempLabel.clProSettings);

                  tempLabel2 = SecretaryForm.AddNewProLabel(tempLayout, 'hLblS_' + uniqID, historyArr.FieldByName('total_amount').AsString + ' DA · Durum: ' + historyArr.FieldByName('status').AsString);
                  tempLabel2.Align = alTop; tempLabel2.clProSettings.FontSize = 9;

                  if (historyArr.FieldByName('status').AsString == 'validee') 
                    tempLabel2.clProSettings.FontColor = clAlphaColor.clHexToColor('#4ade80')
                  else
                    tempLabel2.clProSettings.FontColor = clAlphaColor.clHexToColor('#f87171');

                  tempLabel2.Margins.Top = 2; tempLabel2.SetclProSettings(tempLabel2.clProSettings);
                  historyArr.Next;
                }
              }
            }
          }
        }

      }
    }
  finally
  }
}

// ============================================================
// ÉDITION D'UNE FACTURE
// ============================================================
void OnEditInvoice;
var
  btnSenderEdit: TclProButton;
  invIdStr: String;
{
  btnSenderEdit = TclProButton(SecretaryForm.ClSender);
  invIdStr = btnSenderEdit.Hint;

  if (pendingArr <> nil) 
  {
    pendingArr.First;
    while (not pendingArr.Eof) 
    {
      if (pendingArr.FieldByName('id').AsString == invIdStr) 
      {
        editingInvoiceId = pendingArr.FieldByName('id').AsInteger;
        edtClient.Text = pendingArr.FieldByName('client_name').AsString;
        edtAddress.Text = pendingArr.FieldByName('delivery_address').AsString;
        
        if (pendingArr.FieldByName('invoice_notes') <> nil) {
          edtNotes.Text = pendingArr.FieldByName('invoice_notes').AsString;
        } else {
          edtNotes.Text = '';
        }

        if (pendingArr.FieldByName('first_product_id') <> nil) {
          edtProductId.Text = pendingArr.FieldByName('first_product_id').AsString;
        } else {
          edtProductId.Text = '';
        }

        if (pendingArr.FieldByName('first_qty') <> nil) {
          edtQty.Text = pendingArr.FieldByName('first_qty').AsString;
        } else {
          edtQty.Text = '';
        }

        btnSubmitInvoice.Caption = 'Faturayı Güncelle';
        btnCancelEdit.Visible = True;
        ShowMessage('💡 Fatura #' + invIdStr + ' yüklendi.');
        Exit;
      }
      pendingArr.Next;
    }
  }
}

// ============================================================
// CRÉER OU METTRE À JOUR UNE FACTURE
// ============================================================
void SubmitInvoice;
var
  payloadJson, noteContactStr: String;
{
  if (edtClient.Text == '') 
  {
    ShowMessage('⚠️ Lütfen en az Müşteri Adı alanını doldurun.');
    Exit;
  }

  noteContactStr = Trim(edtNotes.Text);
  if ((edtEmail.Text <> '') || (edtPhone.Text <> '')) 
  {
    noteContactStr = noteContactStr + ' [Tel: ' + edtPhone.Text + ' | E-posta: ' + edtEmail.Text + ']';
  }

  payloadJson = '{"id":' + IntToStr(editingInvoiceId) + ',' +
                 '"client":"' + edtClient.Text + '",' +
                 '"address":"' + edtAddress.Text + '",' +
                 '"notes":"' + noteContactStr + '",' +
                 '"product_id":' + IntToStr(StrToIntDef(edtProductId.Text, 0)) + ',' +
                 '"qty":' + IntToStr(StrToIntDef(edtQty.Text, 0)) + '}';

  restApi = TclRest.Create;
  try
    restApi.Method = rmPOST;
    restApi.Accept = 'application/json';
    restApi.AddBody(payloadJson, 'application/json');
    restApi.Execute;

    responseStr = restApi.Response;
    ShowMessage('📬 Sunucu Yanıtı :' + #13#10 + responseStr);
    
    CancelEdit;
    LoadInvoicesData;
  finally
  }
}

// ============================================================
// AJOUTER UN PRODUIT À UNE FACTURE
// ============================================================
void OnAddItemToInvoice;
var
  btnSender: TclProButton;
  invIdStr, payloadJson: String;
{
  btnSender = TclProButton(SecretaryForm.ClSender);
  invIdStr = btnSender.Hint;

  if ((edtProductId.Text == '') || (edtQty.Text == '')) 
  {
    ShowMessage('💡 Ürün ID ve Miktar bilgilerini girip ardından ➕ butonuna tıklayın.');
    Exit;
  }

  payloadJson = '{"invoice_id":' + invIdStr + ',' +
                 '"product_id":' + edtProductId.Text + ',' +
                 '"qty":' + edtQty.Text + '}';

  restApi = TclRest.Create;
  try
    restApi.Method = rmPOST;
    restApi.Accept = 'application/json';
    restApi.AddBody(payloadJson, 'application/json');
    restApi.Execute;

    responseStr = restApi.Response;
    ShowMessage('➕ ' + responseStr);
    
    edtProductId.Text = ''; edtQty.Text = '';
    LoadInvoicesData;
  finally
  }
}

void OnValidateInvoice;
var
  btnSenderVal: TclProButton;
  invIdStr: String;
{
  btnSenderVal = TclProButton(SecretaryForm.ClSender);
  invIdStr = btnSenderVal.Hint;

  restApi = TclRest.Create;
  try
    restApi.Method = rmPOST;
    restApi.Accept = 'application/json';
    restApi.AddBody('{"id":' + invIdStr + '}', 'application/json');
    restApi.Execute;

    responseStr = restApi.Response;
    if ((responseStr <> '') && (Copy(responseStr, 1, 1) == '{')) 
    {
      rootObj = TCLJSON.ParseToJSONObject(responseStr);
      if ((rootObj <> nil) && rootObj.HasKey('success') && rootObj.GetValue('success').AsBoolean) 
      {
        ShowMessage('✅ Fatura başarıyla onaylandı!');
        LoadInvoicesData;
      }
      else
      {
        if ((rootObj <> nil) && rootObj.HasKey('message')) {
          ShowMessage(rootObj.GetValue('message').AsString);
        }
      }
    }
  finally
  }
}

void OnCancelInvoice;
var
  btnSenderCancel: TclProButton;
  invIdStr: String;
{
  btnSenderCancel = TclProButton(SecretaryForm.ClSender);
  invIdStr = btnSenderCancel.Hint;

  restApi = TclRest.Create;
  try
    restApi.Method = rmPOST;
    restApi.Accept = 'application/json';
    restApi.AddBody('{"id":' + invIdStr + '}', 'application/json');
    restApi.Execute;

    LoadInvoicesData;
  finally
  }
}

// ============================================================
// INITIALISATION FORMULAIRE
// ============================================================
{
  SecretaryForm = TclForm.Create(Self);
  SecretaryForm.SetFormColor('#080d14', '#0d1520', clGVertical);

  Unitnavigate = TclUnit.Create;
  editingInvoiceId = 0;

  if (not Clomosy.PlatformIsMobile) { SecretaryForm.clSetWindowState(fwsMaximized); }

  // TAB BAR INFÉRIEURE
  tabBarPanel = SecretaryForm.AddNewProPanel(SecretaryForm, 'tabBarPanel');
  tabBarPanel.Align = alBottom; tabBarPanel.Height = 58;
  clComponent.SetupComponent(tabBarPanel, '{"BackgroundColor":"#07101c", "BorderColor":"#1a2d42", "BorderWidth":1}');

  btnTabInvoices = SecretaryForm.AddNewProButton(tabBarPanel, 'btnTabInvoices', 'Faturalar');
  btnTabInvoices.Align = alLeft; btnTabInvoices.Width = 120;
  clComponent.SetupComponent(btnTabInvoices, '{"BackgroundColor":"#07101c", "TextColor":"#00d4ff", "RoundHeight":0, "RoundWidth":0}');
  SecretaryForm.AddNewEvent(btnTabInvoices, tbeOnClick, 'ShowInvoiceSection');

  btnTabStockView = SecretaryForm.AddNewProButton(tabBarPanel, 'btnTabStockView', 'Stok');
  btnTabStockView.Align = alLeft; btnTabStockView.Width = 120;
  clComponent.SetupComponent(btnTabStockView, '{"BackgroundColor":"#07101c", "TextColor":"#4a6580", "RoundHeight":0, "RoundWidth":0}');
  SecretaryForm.AddNewEvent(btnTabStockView, tbeOnClick, 'ShowStockSection');

  // LAYOUT PRINCIPAL
  mainLayout = SecretaryForm.AddNewLayout(SecretaryForm, 'mainLayout');
  mainLayout.Align = alClient;

  // HEADER
  headerLayout = SecretaryForm.AddNewLayout(mainLayout, 'headerLayout');
  headerLayout.Align = alTop; headerLayout.Height = 60; headerLayout.Margins.Left = 16; headerLayout.Margins.Right = 16; headerLayout.Margins.Top = 10;

  lblKicker = SecretaryForm.AddNewProLabel(headerLayout, 'lblKicker', 'SEKRETERLİK & SİPARİŞ ALANI');
  lblKicker.Align = alTop; lblKicker.Height = 14;
  lblKicker.clProSettings.FontColor = clAlphaColor.clHexToColor('#00d4ff');
  lblKicker.clProSettings.FontSize = 10;
  lblKicker.clProSettings.TextSettings.Font.Style = [fsBold];
  lblKicker.SetclProSettings(lblKicker.clProSettings);

  lblTitle = SecretaryForm.AddNewProLabel(headerLayout, 'lblTitle', 'Faturalandırma & Siparişler');
  lblTitle.Align = alTop; lblTitle.Height = 32;
  lblTitle.clProSettings.FontColor = clAlphaColor.clHexToColor('#e2eaf5');
  lblTitle.clProSettings.FontSize = 22;
  lblTitle.clProSettings.TextSettings.Font.Style = [fsBold];
  lblTitle.SetclProSettings(lblTitle.clProSettings);

  // SWITCHER (BOUTONS DE NAVIGATION HAUT DÉESPACÉS ET ÉLARGIS)
  switcherLayout = SecretaryForm.AddNewLayout(mainLayout, 'switcherLayout');
  switcherLayout.Align = alTop; switcherLayout.Height = 40; switcherLayout.Margins.Left = 16; switcherLayout.Margins.Right = 16; switcherLayout.Margins.Bottom = 10;

  // 1. Bouton "Fatura Oluştur" (à gauche)
  btnSwitchInvoice = SecretaryForm.AddNewProButton(switcherLayout, 'btnSwitchInvoice', '📄 Fatura Oluştur');
  btnSwitchInvoice.Align = alLeft; btnSwitchInvoice.Width = 115;
  clComponent.SetupComponent(btnSwitchInvoice, '{"BackgroundColor":"#0d1520", "TextColor":"#00d4ff", "RoundHeight":10, "RoundWidth":10, "BorderColor":"#00d4ff40", "BorderWidth":1}');
  SecretaryForm.AddNewEvent(btnSwitchInvoice, tbeOnClick, 'ShowInvoiceSection');

  // 2. Bouton "Yeni Müşteri" (transparent, bordure verte)
  btnOpenAddClient = SecretaryForm.AddNewProButton(switcherLayout, 'btnOpenAddClient', '👤 Yeni Müşteri');
  btnOpenAddClient.Align = alLeft; 
  btnOpenAddClient.Width = 115;
  btnOpenAddClient.Margins.Left = 8; 
  clComponent.SetupComponent(btnOpenAddClient, '{"BackgroundColor":"#00000000", "TextColor":"#22c55e", "RoundHeight":10, "RoundWidth":10, "BorderColor":"#22c55e", "BorderWidth":1}');
  SecretaryForm.AddNewEvent(btnOpenAddClient, tbeOnClick, 'OpenAddClientModal');

  // 3. Bouton "Müşteri Güncelle" (transparent, bordure jaune)
  btnOpenEditClient = SecretaryForm.AddNewProButton(switcherLayout, 'btnOpenEditClient', '✏️ Müşteri Güncelle');
  btnOpenEditClient.Align = alLeft; 
  btnOpenEditClient.Width = 125;
  btnOpenEditClient.Margins.Left = 8;
  clComponent.SetupComponent(btnOpenEditClient, '{"BackgroundColor":"#00000000", "TextColor":"#eab308", "RoundHeight":10, "RoundWidth":10, "BorderColor":"#eab308", "BorderWidth":1}');
  SecretaryForm.AddNewEvent(btnOpenEditClient, tbeOnClick, 'OpenEditClientModal');

  // 4. Bouton "Stoğu Kontrol Et" (à droite)
  btnSwitchStock = SecretaryForm.AddNewProButton(switcherLayout, 'btnSwitchStock', '📦 Stoğu Kontrol');
  btnSwitchStock.Align = alRight; btnSwitchStock.Width = 115;
  clComponent.SetupComponent(btnSwitchStock, '{"BackgroundColor":"#080d14", "TextColor":"#4a6580", "RoundHeight":10, "RoundWidth":10, "BorderColor":"#1a2d42", "BorderWidth":1}');
  SecretaryForm.AddNewEvent(btnSwitchStock, tbeOnClick, 'ShowStockSection');

  scrollBody = SecretaryForm.AddNewVertScrollBox(mainLayout, 'scrollBody');
  scrollBody.Align = alClient; 
  scrollBody.Margins.Left = 16; 
  scrollBody.Margins.Right = 16;

  // FORMULAIRE DE SAISIE DE FACTURE
  formInvoicePanel = SecretaryForm.AddNewProPanel(scrollBody, 'formInvoicePanel');
  formInvoicePanel.Align = alTop; 
  formInvoicePanel.Height = 440; 
  formInvoicePanel.Margins.Bottom = 16;
  clComponent.SetupComponent(formInvoicePanel, '{"BackgroundColor":"#0d1520", "RoundHeight":16, "RoundWidth":16, "BorderColor":"#1a2d42", "BorderWidth":1}');

  // 1. 💡 CRÉATION ET ALIGNEMENT DU TITRE EN PREMIER EN HAUT DU PANNEAU
  lblFormTitle = SecretaryForm.AddNewProLabel(formInvoicePanel, 'lblFormTitle', '📄 FATURA OLUŞTUR / DÜZENLE');
  lblFormTitle.Align = alTop; 
  lblFormTitle.Height = 28; 
  lblFormTitle.Margins.Left = 14;
  lblFormTitle.Margins.Top = 8;
  lblFormTitle.clProSettings.FontSize = 11; 
  lblFormTitle.clProSettings.FontColor = clAlphaColor.clHexToColor('#00d4ff');
  lblFormTitle.clProSettings.TextSettings.Font.Style = [fsBold];
  lblFormTitle.SetclProSettings(lblFormTitle.clProSettings);

  // 2. 💡 CONTENEUR HORIZONTAL POUR "MÜŞTERİ ADI" + BOUTON "MÜŞTERİ SEÇ" JUSTE EN DESSOUS DU TITRE
  rowClientInput = SecretaryForm.AddNewLayout(formInvoicePanel, 'rowClientInput');
  rowClientInput.Align = alTop; 
  rowClientInput.Height = 38; 
  rowClientInput.Margins.Left = 14; 
  rowClientInput.Margins.Right = 14; 
  rowClientInput.Margins.Top = 6;

  // BOUTON "MÜŞTERİ SEÇ" ALIGNÉ À DROITE (Fond transparent, bordures cyan)
  btnSelectClientForm = SecretaryForm.AddNewProButton(rowClientInput, 'btnSelectClientForm', '👤 Müşteri Seç');
  btnSelectClientForm.Align = alRight; 
  btnSelectClientForm.Width = 110; 
  btnSelectClientForm.Margins.Left = 6;
  clComponent.SetupComponent(btnSelectClientForm, '{"BackgroundColor":"#00000000", "TextColor":"#00d4ff", "RoundHeight":8, "RoundWidth":8, "BorderColor":"#00d4ff", "BorderWidth":1}');
  SecretaryForm.AddNewEvent(btnSelectClientForm, tbeOnClick, 'OpenSelectClientFormModal');

  // EDTCLIENT ALIGNÉ AU CENTRE/GAUCHE (Occupe tout l'espace restant)
  edtClient = SecretaryForm.AddNewProEdit(rowClientInput, 'edtClient', 'Müşteri adı...');
  edtClient.Align = alClient;
  clComponent.SetupComponent(edtClient, '{"BackgroundColor":"#080d14", "TextColor":"#e2eaf5", "RoundHeight":8, "RoundWidth":8, "BorderColor":"#1e3552", "BorderWidth":1}');

  edtAddress = SecretaryForm.AddNewProEdit(formInvoicePanel, 'edtAddress', 'Teslimat adresi...');
  edtAddress.Align = alTop; 
  edtAddress.Height = 38; 
  edtAddress.Margins.Left = 14; 
  edtAddress.Margins.Right = 14; 
  edtAddress.Margins.Top = 6;
  clComponent.SetupComponent(edtAddress, '{"BackgroundColor":"#080d14", "TextColor":"#e2eaf5", "RoundHeight":8, "RoundWidth":8, "BorderColor":"#1e3552", "BorderWidth":1}');

  edtEmail = SecretaryForm.AddNewProEdit(formInvoicePanel, 'edtEmail', 'E-posta adresi...');
  edtEmail.Align = alTop; edtEmail.Height = 38; edtEmail.Margins.Left = 14; edtEmail.Margins.Right = 14; edtEmail.Margins.Top = 6;
  clComponent.SetupComponent(edtEmail, '{"BackgroundColor":"#080d14", "TextColor":"#e2eaf5", "RoundHeight":8, "RoundWidth":8, "BorderColor":"#1e3552", "BorderWidth":1}');

  edtPhone = SecretaryForm.AddNewProEdit(formInvoicePanel, 'edtPhone', 'Telefon numarası...');
  edtPhone.Align = alTop; edtPhone.Height = 38; edtPhone.Margins.Left = 14; edtPhone.Margins.Right = 14; edtPhone.Margins.Top = 6;
  clComponent.SetupComponent(edtPhone, '{"BackgroundColor":"#080d14", "TextColor":"#e2eaf5", "RoundHeight":8, "RoundWidth":8, "BorderColor":"#1e3552", "BorderWidth":1}');

  edtNotes = SecretaryForm.AddNewProEdit(formInvoicePanel, 'edtNotes', 'Notlar / Teslimat talimatları...');
  edtNotes.Align = alTop; edtNotes.Height = 38; edtNotes.Margins.Left = 14; edtNotes.Margins.Right = 14; edtNotes.Margins.Top = 6;
  clComponent.SetupComponent(edtNotes, '{"BackgroundColor":"#080d14", "TextColor":"#e2eaf5", "RoundHeight":8, "RoundWidth":8, "BorderColor":"#1e3552", "BorderWidth":1}');

  tempLayout = SecretaryForm.AddNewLayout(formInvoicePanel, 'rowQtyPrice');
  tempLayout.Align = alTop; tempLayout.Height = 38; tempLayout.Margins.Left = 14; tempLayout.Margins.Right = 14; tempLayout.Margins.Top = 6;

  edtProductId = SecretaryForm.AddNewProEdit(tempLayout, 'edtProductId', 'Ürün ID');
  edtProductId.Align = alLeft; edtProductId.Width = 140;
  clComponent.SetupComponent(edtProductId, '{"BackgroundColor":"#080d14", "TextColor":"#e2eaf5", "RoundHeight":8, "RoundWidth":8, "BorderColor":"#1e3552", "BorderWidth":1}');

  edtQty = SecretaryForm.AddNewProEdit(tempLayout, 'edtQty', 'Miktar');
  edtQty.Align = alRight; edtQty.Width = 150;
  clComponent.SetupComponent(edtQty, '{"BackgroundColor":"#080d14", "TextColor":"#e2eaf5", "RoundHeight":8, "RoundWidth":8, "BorderColor":"#1e3552", "BorderWidth":1}');

  btnSubmitInvoice = SecretaryForm.AddNewProButton(formInvoicePanel, 'btnSubmitInvoice', 'Faturayı Oluştur');
  btnSubmitInvoice.Align = alTop; btnSubmitInvoice.Height = 40; btnSubmitInvoice.Margins.Left = 14; btnSubmitInvoice.Margins.Right = 14; btnSubmitInvoice.Margins.Top = 10;
  clComponent.SetupComponent(btnSubmitInvoice, '{"BackgroundColor":"#00d4ff18", "TextColor":"#ededed", "RoundHeight":10, "RoundWidth":10, "BorderColor":"#00d4ff40", "BorderWidth":1}');
  SecretaryForm.AddNewEvent(btnSubmitInvoice, tbeOnClick, 'SubmitInvoice');

  btnCancelEdit = SecretaryForm.AddNewProButton(formInvoicePanel, 'btnCancelEdit', 'Düzenlemeyi İptal Et');
  btnCancelEdit.Align = alTop; btnCancelEdit.Height = 30; btnCancelEdit.Margins.Left = 14; btnCancelEdit.Margins.Right = 14; btnCancelEdit.Margins.Top = 6;
  btnCancelEdit.Visible = False;
  clComponent.SetupComponent(btnCancelEdit, '{"BackgroundColor":"#f8717118", "TextColor":"#ededed", "RoundHeight":10, "RoundWidth":10, "BorderColor":"#f8717140", "BorderWidth":1}');
  SecretaryForm.AddNewEvent(btnCancelEdit, tbeOnClick, 'CancelEdit');

  // FACTURES EN ATTENTE
  pendingPanel = SecretaryForm.AddNewProPanel(scrollBody, 'pendingPanel');
  pendingPanel.Align = alTop; pendingPanel.Height = 240; pendingPanel.Margins.Bottom = 14;
  clComponent.SetupComponent(pendingPanel, '{"BackgroundColor":"#0d1520", "RoundHeight":16, "RoundWidth":16, "BorderColor":"#1a2d42", "BorderWidth":1}');

  lblPendingTitle = SecretaryForm.AddNewProLabel(pendingPanel, 'lblPendingTitle', '⏳ BEKLEYEN MÜŞTERİ SİPARİŞLERİ');
  lblPendingTitle.Align = alTop; lblPendingTitle.Height = 28; lblPendingTitle.Margins.Left = 14; lblPendingTitle.Margins.Top = 8;
  lblPendingTitle.clProSettings.FontSize = 11; lblPendingTitle.clProSettings.FontColor = clAlphaColor.clHexToColor('#e2eaf5');
  lblPendingTitle.clProSettings.TextSettings.Font.Style = [fsBold];
  lblPendingTitle.SetclProSettings(lblPendingTitle.clProSettings);

  pendingScrollBox = SecretaryForm.AddNewVertScrollBox(pendingPanel, 'pendingScrollBox');
  pendingScrollBox.Align = alClient; pendingScrollBox.Margins.Left = 8; pendingScrollBox.Margins.Right = 8;

  // HISTORIQUE DU JOUR
  historyPanel = SecretaryForm.AddNewProPanel(scrollBody, 'historyPanel');
  historyPanel.Align = alTop; historyPanel.Height = 220; historyPanel.Margins.Bottom = 16;
  clComponent.SetupComponent(historyPanel, '{"BackgroundColor":"#0d1520", "RoundHeight":16, "RoundWidth":16, "BorderColor":"#1a2d42", "BorderWidth":1}');

  lblHistoryTitle = SecretaryForm.AddNewProLabel(historyPanel, 'lblHistoryTitle', '📋 BUGÜNÜN GEÇMİŞİ (ONAYLANAN VE İPTAL EDİLENLER)');
  lblHistoryTitle.Align = alTop; lblHistoryTitle.Height = 28; lblHistoryTitle.Margins.Left = 14; lblHistoryTitle.Margins.Top = 8;
  lblHistoryTitle.clProSettings.FontSize = 11; lblHistoryTitle.clProSettings.FontColor = clAlphaColor.clHexToColor('#4ade80');
  lblHistoryTitle.clProSettings.TextSettings.Font.Style = [fsBold];
  lblHistoryTitle.SetclProSettings(lblHistoryTitle.clProSettings);

  historyScrollBox = SecretaryForm.AddNewVertScrollBox(historyPanel, 'historyScrollBox');
  historyScrollBox.Align = alClient; historyScrollBox.Margins.Left = 8; historyScrollBox.Margins.Right = 8;

  // SECTION STOCK DYNAMIQUE
  stockPanel = SecretaryForm.AddNewProPanel(scrollBody, 'stockPanel');
  stockPanel.Align = alTop; stockPanel.Height = 350; stockPanel.Visible = False;
  clComponent.SetupComponent(stockPanel, '{"BackgroundColor":"#0d1520", "RoundHeight":16, "RoundWidth":16, "BorderColor":"#1a2d42", "BorderWidth":1}');

  stockHeaderLayout = SecretaryForm.AddNewLayout(stockPanel, 'stockHeaderLayout');
  stockHeaderLayout.Align = alTop; stockHeaderLayout.Height = 38; stockHeaderLayout.Margins.Left = 14; stockHeaderLayout.Margins.Right = 14; stockHeaderLayout.Margins.Top = 8;

  lblStockTitle = SecretaryForm.AddNewProLabel(stockHeaderLayout, 'lblStockTitle', '📦 STOK KONTROLÜ');
  lblStockTitle.Align = alClient;
  lblStockTitle.clProSettings.FontSize = 11; lblStockTitle.clProSettings.FontColor = clAlphaColor.clHexToColor('#00d4ff');
  lblStockTitle.clProSettings.TextSettings.Font.Style = [fsBold];
  lblStockTitle.SetclProSettings(lblStockTitle.clProSettings);

  edtSearchStock = SecretaryForm.AddNewProEdit(stockHeaderLayout, 'edtSearchStock', '🔍 Ara (ID / İsim)...');
  edtSearchStock.Align = alRight; edtSearchStock.Width = 170;
  clComponent.SetupComponent(edtSearchStock, '{"BackgroundColor":"#080d14", "TextColor":"#e2eaf5", "RoundHeight":8, "RoundWidth":8, "BorderColor":"#1e3552", "BorderWidth":1}');
  SecretaryForm.AddNewEvent(edtSearchStock, tbeOnChange, 'OnSearchStockChange');

  stockScrollBox = SecretaryForm.AddNewVertScrollBox(stockPanel, 'stockScrollBox');
  stockScrollBox.Align = alClient; stockScrollBox.Margins.Left = 8; stockScrollBox.Margins.Right = 8; stockScrollBox.Margins.Top = 6;

  // ============================================================
  // POP-UP MODAL SELECTION CLIENT ("MÜŞTERİ SEÇ")
  // ============================================================
  ModalSelectClientOverlay = SecretaryForm.AddNewLayout(SecretaryForm, 'ModalSelectClientOverlay');
  ModalSelectClientOverlay.Align = alClient;
  ModalSelectClientOverlay.Visible = False;

  ModalSelectClientCard = SecretaryForm.AddNewProPanel(ModalSelectClientOverlay, 'ModalSelectClientCard');
  ModalSelectClientCard.Align = alCenter; ModalSelectClientCard.Width = 320; ModalSelectClientCard.Height = 160;
  ModalSelectClientCard.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#0d1520');
  ModalSelectClientCard.clProSettings.BorderColor = clAlphaColor.clHexToColor('#00d4ff');
  ModalSelectClientCard.clProSettings.BorderWidth = 1; 
  ModalSelectClientCard.clProSettings.RoundWidth = 16; 
  ModalSelectClientCard.clProSettings.RoundHeight = 16;
  ModalSelectClientCard.SetclProSettings(ModalSelectClientCard.clProSettings);

  ModalSelectClientTitle = SecretaryForm.AddNewProLabel(ModalSelectClientCard, 'ModalSelectClientTitle', '👤 Kayıtlı Müşteri Seçin');
  ModalSelectClientTitle.Align = alTop; ModalSelectClientTitle.Height = 30; ModalSelectClientTitle.Margins.Left = 14; ModalSelectClientTitle.Margins.Top = 10;
  ModalSelectClientTitle.clProSettings.FontColor = clAlphaColor.clHexToColor('#00d4ff'); 
  ModalSelectClientTitle.clProSettings.FontSize = 12; 
  ModalSelectClientTitle.clProSettings.TextSettings.Font.Style = [fsBold];
  ModalSelectClientTitle.SetclProSettings(ModalSelectClientTitle.clProSettings);

  CmbClientListModal = SecretaryForm.AddNewComboBox(ModalSelectClientCard, 'CmbClientListModal');
  CmbClientListModal.Align = alTop; CmbClientListModal.Height = 36; CmbClientListModal.Margins.Left = 14; CmbClientListModal.Margins.Right = 14; CmbClientListModal.Margins.Top = 8;

  ModalSelectClientButtonsLayout = SecretaryForm.AddNewLayout(ModalSelectClientCard, 'ModalSelectClientButtonsLayout');
  ModalSelectClientButtonsLayout.Align = alBottom; ModalSelectClientButtonsLayout.Height = 45; ModalSelectClientButtonsLayout.Margins.Left = 14; ModalSelectClientButtonsLayout.Margins.Right = 14; ModalSelectClientButtonsLayout.Margins.Bottom = 10;

  BtnModalCancelSelectClient = SecretaryForm.AddNewProButton(ModalSelectClientButtonsLayout, 'BtnModalCancelSelectClient', 'İptal');
  BtnModalCancelSelectClient.Align = alLeft; BtnModalCancelSelectClient.Width = 130; BtnModalCancelSelectClient.Height = 35;
  clComponent.SetupComponent(BtnModalCancelSelectClient, '{"BackgroundColor":"#f8717120", "TextColor":"#eeeded", "RoundHeight":8, "RoundWidth":8, "BorderColor":"#f87171", "BorderWidth":1}');
  SecretaryForm.AddNewEvent(BtnModalCancelSelectClient, tbeOnClick, 'CloseSelectClientFormModal');

  BtnModalConfirmSelectClient = SecretaryForm.AddNewProButton(ModalSelectClientButtonsLayout, 'BtnModalConfirmSelectClient', 'Seç');
  BtnModalConfirmSelectClient.Align = alRight; BtnModalConfirmSelectClient.Width = 130; BtnModalConfirmSelectClient.Height = 35;
  clComponent.SetupComponent(BtnModalConfirmSelectClient, '{"BackgroundColor":"#00d4ff", "TextColor":"#080d14", "RoundHeight":8, "RoundWidth":8}');
  SecretaryForm.AddNewEvent(BtnModalConfirmSelectClient, tbeOnClick, 'ConfirmSelectClientFromModal');

  // ============================================================
  // POP-UP MODAL NOUVEAU CLIENT (YENİ MÜŞTERİ EKLE)
  // ============================================================
  ModalClientOverlay = SecretaryForm.AddNewLayout(SecretaryForm, 'ModalClientOverlay');
  ModalClientOverlay.Align = alClient;
  ModalClientOverlay.Visible = False;

  ModalClientCard = SecretaryForm.AddNewProPanel(ModalClientOverlay, 'ModalClientCard');
  ModalClientCard.Align = alCenter; ModalClientCard.Width = 320; ModalClientCard.Height = 320;
  ModalClientCard.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#0d1520');
  ModalClientCard.clProSettings.BorderColor = clAlphaColor.clHexToColor('#22c55e');
  ModalClientCard.clProSettings.BorderWidth = 1; 
  ModalClientCard.clProSettings.RoundWidth = 16; 
  ModalClientCard.clProSettings.RoundHeight = 16;
  ModalClientCard.SetclProSettings(ModalClientCard.clProSettings);

  ModalClientTitle = SecretaryForm.AddNewProLabel(ModalClientCard, 'ModalClientTitle', '👤 Yeni Müşteri Ekle');
  ModalClientTitle.Align = alTop; ModalClientTitle.Height = 30; ModalClientTitle.Margins.Left = 14; ModalClientTitle.Margins.Top = 10;
  ModalClientTitle.clProSettings.FontColor = clAlphaColor.clHexToColor('#22c55e'); 
  ModalClientTitle.clProSettings.FontSize = 13; 
  ModalClientTitle.clProSettings.TextSettings.Font.Style = [fsBold];
  ModalClientTitle.SetclProSettings(ModalClientTitle.clProSettings);

  EdtClientNameModal = SecretaryForm.AddNewProEdit(ModalClientCard, 'EdtClientNameModal', 'Müşteri Adı Soyadı...');
  EdtClientNameModal.Align = alTop; EdtClientNameModal.Height = 34; EdtClientNameModal.Margins.Left = 14; EdtClientNameModal.Margins.Right = 14; EdtClientNameModal.Margins.Top = 6;
  clComponent.SetupComponent(EdtClientNameModal, '{"BackgroundColor":"#080d14", "TextColor":"#e2eaf5", "RoundHeight":6, "RoundWidth":6, "BorderColor":"#1a2d42", "BorderWidth":1}');

  EdtClientEmailModal = SecretaryForm.AddNewProEdit(ModalClientCard, 'EdtClientEmailModal', 'E-posta Adresi...');
  EdtClientEmailModal.Align = alTop; EdtClientEmailModal.Height = 34; EdtClientEmailModal.Margins.Left = 14; EdtClientEmailModal.Margins.Right = 14; EdtClientEmailModal.Margins.Top = 6;
  clComponent.SetupComponent(EdtClientEmailModal, '{"BackgroundColor":"#080d14", "TextColor":"#e2eaf5", "RoundHeight":6, "RoundWidth":6, "BorderColor":"#1a2d42", "BorderWidth":1}');

  EdtClientPhoneModal = SecretaryForm.AddNewProEdit(ModalClientCard, 'EdtClientPhoneModal', 'Telefon Numarası...');
  EdtClientPhoneModal.Align = alTop; EdtClientPhoneModal.Height = 34; EdtClientPhoneModal.Margins.Left = 14; EdtClientPhoneModal.Margins.Right = 14; EdtClientPhoneModal.Margins.Top = 6;
  clComponent.SetupComponent(EdtClientPhoneModal, '{"BackgroundColor":"#080d14", "TextColor":"#e2eaf5", "RoundHeight":6, "RoundWidth":6, "BorderColor":"#1a2d42", "BorderWidth":1}');

  EdtClientAddressModal = SecretaryForm.AddNewProEdit(ModalClientCard, 'EdtClientAddressModal', 'Teslimat / İkamet Adresi...');
  EdtClientAddressModal.Align = alTop; EdtClientAddressModal.Height = 34; EdtClientAddressModal.Margins.Left = 14; EdtClientAddressModal.Margins.Right = 14; EdtClientAddressModal.Margins.Top = 6;
  clComponent.SetupComponent(EdtClientAddressModal, '{"BackgroundColor":"#080d14", "TextColor":"#e2eaf5", "RoundHeight":6, "RoundWidth":6, "BorderColor":"#1a2d42", "BorderWidth":1}');

  ModalClientButtonsLayout = SecretaryForm.AddNewLayout(ModalClientCard, 'ModalClientButtonsLayout');
  ModalClientButtonsLayout.Align = alBottom; ModalClientButtonsLayout.Height = 45; ModalClientButtonsLayout.Margins.Left = 14; ModalClientButtonsLayout.Margins.Right = 14; ModalClientButtonsLayout.Margins.Bottom = 10;

  BtnModalCancelClient = SecretaryForm.AddNewProButton(ModalClientButtonsLayout, 'BtnModalCancelClient', 'İptal');
  BtnModalCancelClient.Align = alLeft; BtnModalCancelClient.Width = 130; BtnModalCancelClient.Height = 35;
  clComponent.SetupComponent(BtnModalCancelClient, '{"BackgroundColor":"#f8717120", "TextColor":"#eeeded", "RoundHeight":8, "RoundWidth":8, "BorderColor":"#f87171", "BorderWidth":1}');
  SecretaryForm.AddNewEvent(BtnModalCancelClient, tbeOnClick, 'CloseAddClientModal');

  BtnModalSaveClient = SecretaryForm.AddNewProButton(ModalClientButtonsLayout, 'BtnModalSaveClient', 'Kaydet');
  BtnModalSaveClient.Align = alRight; BtnModalSaveClient.Width = 130; BtnModalSaveClient.Height = 35;
  clComponent.SetupComponent(BtnModalSaveClient, '{"BackgroundColor":"#22c55e", "TextColor":"#ffffff", "RoundHeight":8, "RoundWidth":8}');
  SecretaryForm.AddNewEvent(BtnModalSaveClient, tbeOnClick, 'SaveNewClient');

  // ============================================================
  // POP-UP MODAL MODIFICATION CLIENT (MÜŞTERİ BİLGİSİ DEĞİŞTİR)
  // ============================================================
  ModalEditClientOverlay = SecretaryForm.AddNewLayout(SecretaryForm, 'ModalEditClientOverlay');
  ModalEditClientOverlay.Align = alClient;
  ModalEditClientOverlay.Visible = False;

  ModalEditClientCard = SecretaryForm.AddNewProPanel(ModalEditClientOverlay, 'ModalEditClientCard');
  ModalEditClientCard.Align = alCenter; ModalEditClientCard.Width = 330; ModalEditClientCard.Height = 330;
  ModalEditClientCard.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#0d1520');
  ModalEditClientCard.clProSettings.BorderColor = clAlphaColor.clHexToColor('#eab308');
  ModalEditClientCard.clProSettings.BorderWidth = 1; 
  ModalEditClientCard.clProSettings.RoundWidth = 16; 
  ModalEditClientCard.clProSettings.RoundHeight = 16;
  ModalEditClientCard.SetclProSettings(ModalEditClientCard.clProSettings);

  ModalEditClientTitle = SecretaryForm.AddNewProLabel(ModalEditClientCard, 'ModalEditClientTitle', '✏️ Müşteri Bilgisi Değiştir');
  ModalEditClientTitle.Align = alTop; ModalEditClientTitle.Height = 30; ModalEditClientTitle.Margins.Left = 14; ModalEditClientTitle.Margins.Top = 10;
  ModalEditClientTitle.clProSettings.FontColor = clAlphaColor.clHexToColor('#eab308'); 
  ModalEditClientTitle.clProSettings.FontSize = 13; 
  ModalEditClientTitle.clProSettings.TextSettings.Font.Style = [fsBold];
  ModalEditClientTitle.SetclProSettings(ModalEditClientTitle.clProSettings);

  CmbClientSelect = SecretaryForm.AddNewComboBox(ModalEditClientCard, 'CmbClientSelect');
  CmbClientSelect.Align = alTop; CmbClientSelect.Height = 36; CmbClientSelect.Margins.Left = 14; CmbClientSelect.Margins.Right = 14; CmbClientSelect.Margins.Top = 6;
  SecretaryForm.AddNewEvent(CmbClientSelect, tbeOnChange, 'OnClientSelectedFromCombo');

  EdtEditClientEmailModal = SecretaryForm.AddNewProEdit(ModalEditClientCard, 'EdtEditClientEmailModal', 'Yeni E-posta Adresi...');
  EdtEditClientEmailModal.Align = alTop; EdtEditClientEmailModal.Height = 34; EdtEditClientEmailModal.Margins.Left = 14; EdtEditClientEmailModal.Margins.Right = 14; EdtEditClientEmailModal.Margins.Top = 8;
  clComponent.SetupComponent(EdtEditClientEmailModal, '{"BackgroundColor":"#080d14", "TextColor":"#e2eaf5", "RoundHeight":6, "RoundWidth":6, "BorderColor":"#1a2d42", "BorderWidth":1}');

  EdtEditClientPhoneModal = SecretaryForm.AddNewProEdit(ModalEditClientCard, 'EdtEditClientPhoneModal', 'Yeni Telefon Numarası...');
  EdtEditClientPhoneModal.Align = alTop; EdtEditClientPhoneModal.Height = 34; EdtEditClientPhoneModal.Margins.Left = 14; EdtEditClientPhoneModal.Margins.Right = 14; EdtEditClientPhoneModal.Margins.Top = 6;
  clComponent.SetupComponent(EdtEditClientPhoneModal, '{"BackgroundColor":"#080d14", "TextColor":"#e2eaf5", "RoundHeight":6, "RoundWidth":6, "BorderColor":"#1a2d42", "BorderWidth":1}');

  EdtEditClientAddressModal = SecretaryForm.AddNewProEdit(ModalEditClientCard, 'EdtEditClientAddressModal', 'Yeni Adres...');
  EdtEditClientAddressModal.Align = alTop; EdtEditClientAddressModal.Height = 34; EdtEditClientAddressModal.Margins.Left = 14; EdtEditClientAddressModal.Margins.Right = 14; EdtEditClientAddressModal.Margins.Top = 6;
  clComponent.SetupComponent(EdtEditClientAddressModal, '{"BackgroundColor":"#080d14", "TextColor":"#e2eaf5", "RoundHeight":6, "RoundWidth":6, "BorderColor":"#1a2d42", "BorderWidth":1}');

  ModalEditClientButtonsLayout = SecretaryForm.AddNewLayout(ModalEditClientCard, 'ModalEditClientButtonsLayout');
  ModalEditClientButtonsLayout.Align = alBottom; ModalEditClientButtonsLayout.Height = 45; ModalEditClientButtonsLayout.Margins.Left = 14; ModalEditClientButtonsLayout.Margins.Right = 14; ModalEditClientButtonsLayout.Margins.Bottom = 10;

  BtnModalCancelEditClient = SecretaryForm.AddNewProButton(ModalEditClientButtonsLayout, 'BtnModalCancelEditClient', 'İptal');
  BtnModalCancelEditClient.Align = alLeft; BtnModalCancelEditClient.Width = 130; BtnModalCancelEditClient.Height = 35;
  clComponent.SetupComponent(BtnModalCancelEditClient, '{"BackgroundColor":"#f8717120", "TextColor":"#eeeded", "RoundHeight":8, "RoundWidth":8, "BorderColor":"#f87171", "BorderWidth":1}');
  SecretaryForm.AddNewEvent(BtnModalCancelEditClient, tbeOnClick, 'CloseEditClientModal');

  BtnModalSaveEditClient = SecretaryForm.AddNewProButton(ModalEditClientButtonsLayout, 'BtnModalSaveEditClient', 'Kaydet');
  BtnModalSaveEditClient.Align = alRight; BtnModalSaveEditClient.Width = 130; BtnModalSaveEditClient.Height = 35;
  clComponent.SetupComponent(BtnModalSaveEditClient, '{"BackgroundColor":"#eab308", "TextColor":"#080d14", "RoundHeight":8, "RoundWidth":8}');
  SecretaryForm.AddNewEvent(BtnModalSaveEditClient, tbeOnClick, 'SaveEditedClient');

  // Initialisation et chargement des données
  LoadInvoicesData;
  SecretaryForm.Run;
}
https://static.cloudflareinsights.com/beacon.min.js/v4513226cdae34746b4dedf0b4dfa099e1781791509496" integrity="sha512-ZE9pZaUXND66v380QUtch/5sE9tPFh2zg45pR2PB0CVkCtOREv2AJKkSidISWkysEuQ0EH8faUU5du78bx87UQ==" data-cf-beacon="{"version":"2024.11.0","token":"439455f3e46c40b98dbd42a2f1a954d8","r":1}" crossorigin="anonymous">
Yukarı Dön
Emr.Erkmn Açılır Kutu İzle
Moderatör
Moderatör


Kayıt Tarihi: 28 Şubat 2025
Durum: Aktif
Puanlar: 1005
Mesaj Seçenekleri Mesaj Seçenekleri   Teşekkürler (0) Teşekkürler(0)   Alıntı Emr.Erkmn Alıntı  Yanıt YazCevapla Mesajın Direkt Linki Gönderim Zamanı: 3 Saat 26 Dakika Önce Saat 15:04
Merhaba Barhtez, 

İlgili yerleri düzeltebilir misin 


  formInvoicePanel = SecretaryForm.AddNewProPanel(scrollBody, 'formInvoicePanel');
  formInvoicePanel.Align = alTop; 
  formInvoicePanel.Height = 440; 
  formInvoicePanel.Margins.Bottom = 16;
  clComponent.SetupComponent(formInvoicePanel, '{"BackgroundColor":"#0d1520", "RoundHeight":16, "RoundWidth":16, "BorderColor":"#1a2d42", "BorderWidth":1}');

  lblFormTitle = SecretaryForm.AddNewProLabel(formInvoicePanel, 'lblFormTitle', '📄 FATURA OLUŞTUR / DÜZENLE');
  lblFormTitle.Align = alTop; 
  lblFormTitle.Height = 28; 
  lblFormTitle.Margins.Left = 14;
  lblFormTitle.Margins.Top = 8;
  lblFormTitle.clProSettings.FontSize = 11; 
  lblFormTitle.clProSettings.FontColor = clAlphaColor.clHexToColor('#00d4ff');
  lblFormTitle.clProSettings.TextSettings.Font.Style = [fsBold];
  lblFormTitle.SetclProSettings(lblFormTitle.clProSettings);

  btnSubmitInvoice = SecretaryForm.AddNewProButton(formInvoicePanel, 'btnSubmitInvoice', 'Faturayı Oluştur');
  btnSubmitInvoice.Align = alTop; 
  btnSubmitInvoice.Height = 38; 
  btnSubmitInvoice.Margins.Left = 14; 
  btnSubmitInvoice.Margins.Right = 14; 
  btnSubmitInvoice.Margins.Top = 6;
  clComponent.SetupComponent(btnSubmitInvoice, '{"BackgroundColor":"#00d4ff18", "TextColor":"#ededed", "RoundHeight":10, "RoundWidth":10, "BorderColor":"#00d4ff40", "BorderWidth":1}');
  SecretaryForm.AddNewEvent(btnSubmitInvoice, tbeOnClick, 'SubmitInvoice');

  btnCancelEdit = SecretaryForm.AddNewProButton(formInvoicePanel, 'btnCancelEdit', 'Düzenlemeyi İptal Et');
  btnCancelEdit.Align = alTop; 
  btnCancelEdit.Height = 30; 
  btnCancelEdit.Margins.Left = 14; 
  btnCancelEdit.Margins.Right = 14; 
  btnCancelEdit.Margins.Top = 4;
  btnCancelEdit.Visible = False;
  clComponent.SetupComponent(btnCancelEdit, '{"BackgroundColor":"#f8717118", "TextColor":"#ededed", "RoundHeight":10, "RoundWidth":10, "BorderColor":"#f8717140", "BorderWidth":1}');
  SecretaryForm.AddNewEvent(btnCancelEdit, tbeOnClick, 'CancelEdit');

  rowClientInput = SecretaryForm.AddNewLayout(formInvoicePanel, 'rowClientInput');
  rowClientInput.Align = alTop; 
  rowClientInput.Height = 38; 
  rowClientInput.Margins.Left = 14; 
  rowClientInput.Margins.Right = 14; 
  rowClientInput.Margins.Top = 8;

  btnSelectClientForm = SecretaryForm.AddNewProButton(rowClientInput, 'btnSelectClientForm', '👤 Müşteri Seç');
  btnSelectClientForm.Align = alRight; 
  btnSelectClientForm.Width = 110; 
  btnSelectClientForm.Margins.Left = 6;
  clComponent.SetupComponent(btnSelectClientForm, '{"BackgroundColor":"#00000000", "TextColor":"#00d4ff", "RoundHeight":8, "RoundWidth":8, "BorderColor":"#00d4ff", "BorderWidth":1}');
  SecretaryForm.AddNewEvent(btnSelectClientForm, tbeOnClick, 'OpenSelectClientFormModal');

  edtClient = SecretaryForm.AddNewProEdit(rowClientInput, 'edtClient', 'Müşteri adı...');
  edtClient.Align = alClient;
  clComponent.SetupComponent(edtClient, '{"BackgroundColor":"#080d14", "TextColor":"#e2eaf5", "RoundHeight":8, "RoundWidth":8, "BorderColor":"#1e3552", "BorderWidth":1}');

  edtAddress = SecretaryForm.AddNewProEdit(formInvoicePanel, 'edtAddress', 'Teslimat adresi...');
  edtAddress.Align = alTop; 
  edtAddress.Height = 38; 
  edtAddress.Margins.Left = 14; 
  edtAddress.Margins.Right = 14; 
  edtAddress.Margins.Top = 6;
  clComponent.SetupComponent(edtAddress, '{"BackgroundColor":"#080d14", "TextColor":"#e2eaf5", "RoundHeight":8, "RoundWidth":8, "BorderColor":"#1e3552", "BorderWidth":1}');

  edtEmail = SecretaryForm.AddNewProEdit(formInvoicePanel, 'edtEmail', 'E-posta adresi...');
  edtEmail.Align = alTop; edtEmail.Height = 38; edtEmail.Margins.Left = 14; edtEmail.Margins.Right = 14; edtEmail.Margins.Top = 6;
  clComponent.SetupComponent(edtEmail, '{"BackgroundColor":"#080d14", "TextColor":"#e2eaf5", "RoundHeight":8, "RoundWidth":8, "BorderColor":"#1e3552", "BorderWidth":1}');

  edtPhone = SecretaryForm.AddNewProEdit(formInvoicePanel, 'edtPhone', 'Telefon numarası...');
  edtPhone.Align = alTop; edtPhone.Height = 38; edtPhone.Margins.Left = 14; edtPhone.Margins.Right = 14; edtPhone.Margins.Top = 6;
  clComponent.SetupComponent(edtPhone, '{"BackgroundColor":"#080d14", "TextColor":"#e2eaf5", "RoundHeight":8, "RoundWidth":8, "BorderColor":"#1e3552", "BorderWidth":1}');

  edtNotes = SecretaryForm.AddNewProEdit(formInvoicePanel, 'edtNotes', 'Notlar / Teslimat talimatları...');
  edtNotes.Align = alTop; edtNotes.Height = 38; edtNotes.Margins.Left = 14; edtNotes.Margins.Right = 14; edtNotes.Margins.Top = 6;
  clComponent.SetupComponent(edtNotes, '{"BackgroundColor":"#080d14", "TextColor":"#e2eaf5", "RoundHeight":8, "RoundWidth":8, "BorderColor":"#1e3552", "BorderWidth":1}');

  tempLayout = SecretaryForm.AddNewLayout(formInvoicePanel, 'rowQtyPrice');
  tempLayout.Align = alTop; tempLayout.Height = 38; tempLayout.Margins.Left = 14; tempLayout.Margins.Right = 14; tempLayout.Margins.Top = 6;

  edtProductId = SecretaryForm.AddNewProEdit(tempLayout, 'edtProductId', 'Ürün ID');
  edtProductId.Align = alLeft; edtProductId.Width = 140;
  clComponent.SetupComponent(edtProductId, '{"BackgroundColor":"#080d14", "TextColor":"#e2eaf5", "RoundHeight":8, "RoundWidth":8, "BorderColor":"#1e3552", "BorderWidth":1}');

  edtQty = SecretaryForm.AddNewProEdit(tempLayout, 'edtQty', 'Miktar');
  edtQty.Align = alRight; edtQty.Width = 150;
  clComponent.SetupComponent(edtQty, '{"BackgroundColor":"#080d14", "TextColor":"#e2eaf5", "RoundHeight":8, "RoundWidth":8, "BorderColor":"#1e3552", "BorderWidth":1}');
https://static.cloudflareinsights.com/beacon.min.js/v4513226cdae34746b4dedf0b4dfa099e1781791509496" integrity="sha512-ZE9pZaUXND66v380QUtch/5sE9tPFh2zg45pR2PB0CVkCtOREv2AJKkSidISWkysEuQ0EH8faUU5du78bx87UQ==" data-cf-beacon="{"version":"2024.11.0","token":"439455f3e46c40b98dbd42a2f1a954d8","r":1}" crossorigin="anonymous">
Yukarı Dön
 Yanıt Yaz Yanıt Yaz

Forum Atla Forum İzinleri Açılır Kutu İzle

Forum Software by Web Wiz Forums® version 12.07
Copyright ©2001-2024 Web Wiz Ltd.

Bu Sayfa 0,063 Saniyede Yüklendi.