94 lines
3.5 KiB
C#
94 lines
3.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace AyaNovaQBI
|
|
{
|
|
public partial class InvoiceTemplateBuilder : Form
|
|
{
|
|
public InvoiceTemplateBuilder()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
TextBox _CurrentTextEditor = null;
|
|
private void InvoiceTemplateBuilder_Load(object sender, EventArgs e)
|
|
{
|
|
btnCancel.Text = util.AyaTranslations["Cancel"];
|
|
btnOK.Text = util.AyaTranslations["OK"];
|
|
}
|
|
|
|
private void btnOK_Click(object sender, EventArgs e)
|
|
{
|
|
DialogResult = DialogResult.OK;
|
|
Close();
|
|
}
|
|
|
|
private void btnCancel_Click(object sender, EventArgs e)
|
|
{
|
|
DialogResult = DialogResult.Cancel;
|
|
Close();
|
|
}
|
|
|
|
private void editField_Enter(object sender, EventArgs e)
|
|
{
|
|
_CurrentTextEditor = (TextBox)sender;
|
|
var edittag = _CurrentTextEditor.Tag.ToString();
|
|
foreach (ToolStripMenuItem t in tbManager.Items)
|
|
{
|
|
var menutag = t.Tag.ToString();
|
|
if (!menutag.StartsWith("Insert"))//skip the two permanently visible ones
|
|
{
|
|
t.Visible = edittag == menutag;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void tbManager_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
|
|
{
|
|
if (e.ClickedItem.Tag == null) return;//probably just a container menu item / not a special menu item
|
|
|
|
string tag = e.ClickedItem.Tag.ToString();
|
|
if (tag.StartsWith("~"))
|
|
_CurrentTextEditor.Text = _CurrentTextEditor.Text.Insert(_CurrentTextEditor.SelectionStart, tag);
|
|
else
|
|
{
|
|
switch (tag)
|
|
{
|
|
case "SetDetailed":
|
|
edHeader.Text = "Charges for work order: ~WO#~";
|
|
edFooter.Text = "Service requested: ~ITEM_SUMMARY~";
|
|
edUnit.Text = "Unit Serviced: ~AYAFORMAT~";
|
|
edService.Text = "Service performed by: ~SERVICE_TECH~ Start Date & Time: ~SERVICE_START~ End Date & Time: ~SERVICE_STOP~\r\n" +
|
|
"Service Details: ~DETAILS~";
|
|
edTravel.Text = "Travel Start Date & Time: ~TRAVEL_START~";
|
|
edOutsideService.Text = "Outside Service Repair Charges: ~REPAIR_PRICE~ Outside Service Shipping Charges: ~SHIP_CHARGE~\r\n" +
|
|
"Date Sent: ~SENT~ Date Returned: ~RETURNED~";
|
|
edMiscExpense.Text = "Misc Expenses Summary: ~SUMMARY~";
|
|
edLoanItem.Text = "Item Loaned: ~ITEM~ Date Loaned: ~LOANED~ Date returned: ~LOAN_RETURNED~";
|
|
break;
|
|
|
|
case "SetBrief":
|
|
edHeader.Text = "Charges for work order: ~WO#~";
|
|
edFooter.Text = "";
|
|
edUnit.Text = "";
|
|
edService.Text = "";
|
|
edTravel.Text = "";
|
|
edOutsideService.Text = "";
|
|
edMiscExpense.Text = "";
|
|
edLoanItem.Text = "";
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|