d986936fc6
http://redmine.steamware.net/issues/318 con gestioen edit e buttons dei dati della quotazione standard...
226 lines
6.9 KiB
C#
226 lines
6.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using C2P_Data;
|
|
using SteamWare;
|
|
|
|
namespace C2P.WebUserControls
|
|
{
|
|
public partial class mod_QuoteDet : System.Web.UI.UserControl
|
|
{
|
|
/// <summary>
|
|
/// tipo di quote x la scheda corrente
|
|
/// </summary>
|
|
protected string QuoteType
|
|
{
|
|
get
|
|
{
|
|
return lblQuoteType.Text;
|
|
}
|
|
set
|
|
{
|
|
lblQuoteType.Text = value;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// codice quote x la scheda corrente
|
|
/// </summary>
|
|
protected string CodQuote
|
|
{
|
|
get
|
|
{
|
|
return lblCodQuote.Text;
|
|
}
|
|
set
|
|
{
|
|
lblCodQuote.Text = value;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// rev quote x la scheda corrente
|
|
/// </summary>
|
|
protected string QuoteRev
|
|
{
|
|
get
|
|
{
|
|
return lblQuoteRev.Text;
|
|
}
|
|
set
|
|
{
|
|
lblQuoteRev.Text = value;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// precedente valore richiesto...
|
|
/// </summary>
|
|
protected string prevReq
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.StringSessionObj("prevReqQD");
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal("prevReqQD", value);
|
|
}
|
|
}
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
// recupero valori della chaive della quote da URL...
|
|
if (!Page.IsPostBack)
|
|
{
|
|
// leggo da url e salvo (se ci sono...)
|
|
QuoteType = Request.QueryString["QuoteType"];
|
|
CodQuote = Request.QueryString["CodQuote"];
|
|
QuoteRev = Request.QueryString["QuoteRev"];
|
|
prevReq = "";
|
|
setModVisibility("Header");
|
|
}
|
|
mod_Q_Header1.eh_update += mod_Q_Header1_eh_update;
|
|
mod_Q_Quot1.eh_update += mod_Q_Quot1_eh_update;
|
|
}
|
|
|
|
void mod_Q_Quot1_eh_update(object sender, EventArgs e)
|
|
{
|
|
setModVisibility("");
|
|
}
|
|
|
|
void mod_Q_Header1_eh_update(object sender, EventArgs e)
|
|
{
|
|
setModVisibility("");
|
|
}
|
|
/// <summary>
|
|
/// wrapper traduzione
|
|
/// </summary>
|
|
/// <param name="lemma"></param>
|
|
/// <returns></returns>
|
|
public string traduci(object lemma)
|
|
{
|
|
return user_std.UtSn.Traduci(lemma.ToString());
|
|
}
|
|
/// <summary>
|
|
/// Calcola css dato valore prezzo offerto vs importi full cost e min price
|
|
/// </summary>
|
|
/// <param name="FullCost"></param>
|
|
/// <param name="MinPrice"></param>
|
|
/// <param name="PriceOff"></param>
|
|
/// <returns></returns>
|
|
public string priceVsCost(object _FullCost, object _MinPrice, object _PriceOff)
|
|
{
|
|
string answ = "";
|
|
double FullCost = 0;
|
|
double MinPrice = 0;
|
|
double PriceOff = 0;
|
|
try
|
|
{
|
|
FullCost = Convert.ToDouble(_FullCost);
|
|
MinPrice = Convert.ToDouble(_MinPrice);
|
|
PriceOff = Convert.ToDouble(_PriceOff);
|
|
}
|
|
catch
|
|
{ }
|
|
if (PriceOff > MinPrice)
|
|
{
|
|
answ = "allOk";
|
|
}
|
|
else if (PriceOff > FullCost)
|
|
{
|
|
answ = "warnOrange";
|
|
}
|
|
else
|
|
{
|
|
answ = "warnRed";
|
|
}
|
|
return answ;
|
|
}
|
|
/// <summary>
|
|
/// premuto uno dei buttons dell'header
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void lbt_Click(object sender, EventArgs e)
|
|
{
|
|
LinkButton lBtn = ((LinkButton)sender);
|
|
setModVisibility(lBtn.CommandArgument);
|
|
}
|
|
/// <summary>
|
|
/// sistemazione della visibilità dei moduli di dettaglio/editing
|
|
/// </summary>
|
|
private void setModVisibility(string req)
|
|
{
|
|
switch (req)
|
|
{
|
|
case "Costs":
|
|
mod_Q_Costs1.Visible = true;
|
|
mod_Q_ExtrPar1.Visible = false;
|
|
mod_Q_Header1.Visible = false;
|
|
mod_Q_PackPar1.Visible = false;
|
|
break;
|
|
case "ExtrPar":
|
|
mod_Q_Costs1.Visible = false;
|
|
mod_Q_ExtrPar1.Visible = true;
|
|
mod_Q_Header1.Visible = false;
|
|
mod_Q_PackPar1.Visible = false;
|
|
break;
|
|
case "Header":
|
|
if (prevReq == req) mod_Q_Header1.toggleMode();
|
|
mod_Q_Costs1.Visible = false;
|
|
mod_Q_ExtrPar1.Visible = false;
|
|
mod_Q_Header1.Visible = true;
|
|
mod_Q_PackPar1.Visible = false;
|
|
break;
|
|
case "PackPar":
|
|
mod_Q_Costs1.Visible = false;
|
|
mod_Q_ExtrPar1.Visible = false;
|
|
mod_Q_Header1.Visible = false;
|
|
mod_Q_PackPar1.Visible = true;
|
|
break;
|
|
case "Quote":
|
|
if (prevReq == req) mod_Q_Quot1.toggleMode();
|
|
break;
|
|
default:
|
|
mod_Q_Costs1.Visible = false;
|
|
mod_Q_ExtrPar1.Visible = false;
|
|
mod_Q_Header1.Visible = true;
|
|
mod_Q_PackPar1.Visible = false;
|
|
break;
|
|
}
|
|
prevReq = req;
|
|
// controllo SE sia visibile il pulsante crea offerta (netMargin > 0... DA VERIFICARE)
|
|
bool okCreate = false;
|
|
DS_Quotes.QuoteFull_QRow riga;
|
|
try
|
|
{
|
|
riga = DtProxy.man.taQFQ.getByKey(QuoteType, Convert.ToInt32(CodQuote), Convert.ToInt32(QuoteRev), "N")[0];
|
|
if (riga.NetMar > 0 && riga.PriceOff > 0)
|
|
{
|
|
okCreate = true;
|
|
}
|
|
}
|
|
catch
|
|
{ }
|
|
lbCreateOffer.Visible = okCreate;
|
|
}
|
|
/// <summary>
|
|
/// Verifica se si possibile creare offerta standard (o si debba passare a SIMULAZIONE)
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void lbChkStandard_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
/// <summary>
|
|
/// Crea un offerta (SE
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void lnkCreateOffer_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
}
|
|
} |