using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Web;
|
using System.Web.UI;
|
using System.Web.UI.WebControls;
|
using CY.Infrastructure.Common;
|
using CY.Model;
|
using CY.BLL;
|
namespace CY.WebForm.Pages.sysInquiry
|
{
|
public partial class PriceTool : FrontBasePage
|
{
|
protected void Page_Load(object sender, EventArgs e)
|
{
|
if (!IsPostBack)
|
{
|
txtRemenderTime.Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
|
}
|
if (Request.Params["paperSize"] != null)
|
{
|
string paperSize = string.Empty;
|
int? gramWeight = null;
|
decimal? tonsPrice = null;
|
decimal? reamPrice = null;
|
int? paperOfQua = 0;
|
paperSize = Request.Params["paperSize"].ToString();
|
if (!string.IsNullOrEmpty(Request.Params["gramWeight"].ToString()))
|
{
|
gramWeight = int.Parse(Request.Params["gramWeight"].ToString());
|
}
|
if (!string.IsNullOrEmpty(Request.Params["tonsPrice"].ToString()))
|
{
|
tonsPrice = Convert.ToDecimal(Request.Params["tonsPrice"].ToString());
|
}
|
if (!string.IsNullOrEmpty(Request.Params["reamPrice"].ToString()))
|
{
|
reamPrice = Convert.ToDecimal(Request.Params["reamPrice"].ToString());
|
}
|
if (!string.IsNullOrEmpty(Request.Params["paperOfQua"].ToString()))
|
{
|
paperOfQua = int.Parse(Request.Params["paperOfQua"].ToString());
|
}
|
Response.Write(CalculatePaperPrice(paperSize, gramWeight, tonsPrice, reamPrice, paperOfQua));
|
Response.End();
|
}
|
|
//提交备忘录
|
if (Request["SaveMemo"] != null)
|
{
|
string remenderTime = Request["RemenderTime"].ToString();
|
string content = Request["Content"].ToString();
|
OA_WorkReminder m_OA_WorkReminder = new OA_WorkReminder();
|
m_OA_WorkReminder.FirmId = CurrentUser.MemberId;
|
m_OA_WorkReminder.Content = content;
|
m_OA_WorkReminder.RemenderObject = CurrentUser.TrueName;
|
m_OA_WorkReminder.Remender = CurrentUser.TrueName;
|
m_OA_WorkReminder.RemenderTime = Convert.ToDateTime(remenderTime);
|
m_OA_WorkReminder.Remark = string.Empty;
|
m_OA_WorkReminder.RemenderDept = string.Empty;
|
m_OA_WorkReminder.RemenderType = 2; //提醒类别为2代表的是备忘录
|
m_OA_WorkReminder.IsFinish = 0;
|
OA_WorkReminderBll oA_WorkReminderBll = new OA_WorkReminderBll();
|
m_OA_WorkReminder.RemenderDelState = 0;
|
m_OA_WorkReminder.RemenderObjectDelState = 0;
|
m_OA_WorkReminder.RemindState = 0;
|
bool IsSuccess=oA_WorkReminderBll.InsertModel(m_OA_WorkReminder);
|
Response.Write(IsSuccess ? "1" : "0");
|
Response.End();
|
}
|
}
|
|
/// <summary>
|
/// 纸价转换计算
|
/// </summary>
|
/// <param name="paperSize">纸张尺寸</param>
|
/// <param name="gramgramWeight">克重</param>
|
/// <param name="tonsPrice">吨价</param>
|
/// <param name="reamPrice">令价</param>
|
/// <returns>前台显示json字符串</returns>
|
public string CalculatePaperPrice(string paperSize, int? gramWeight, decimal? tonsPrice, decimal? reamPrice,int? paperOfQua)
|
{
|
//纸张单价
|
decimal? price = 0;
|
|
//令重
|
decimal? reamWeight = 0;
|
|
//令数
|
double? reamNumber = 0;
|
|
//总价
|
decimal? AllPrice = 0;
|
|
string html = "";
|
|
if (gramWeight != null)
|
{
|
if (reamPrice == null)
|
{
|
|
if (!string.IsNullOrEmpty(paperSize) && gramWeight != null && tonsPrice != null)
|
{
|
string[] paperSizes = paperSize.Split('×');
|
|
double widht = paperSizes[0].ToDouble2().Value / 1000;
|
double height = paperSizes[1].ToDouble2().Value / 1000;
|
|
double _gramWeight = gramWeight.ToDouble2().Value / 1000;
|
|
double area = widht * height;
|
|
price = (area * _gramWeight * (tonsPrice.ToDouble2() / 1000)).ToDecimal2();
|
|
reamWeight = (widht * height * _gramWeight * 500).ToDecimal2();
|
|
reamWeight = reamWeight.ToDecimal2();
|
|
reamNumber = (1000 / reamWeight).ToDouble2().Value.ToString("0.00").ToDouble2();
|
|
reamPrice = price * 500;
|
|
}
|
}
|
else
|
{
|
if (!string.IsNullOrEmpty(paperSize) && gramWeight != null && reamPrice != null)
|
{
|
string[] paperSizes = paperSize.Split('×');
|
|
double widht = paperSizes[0].ToDouble2().Value / 1000;
|
|
double height = paperSizes[1].ToDouble2().Value / 1000;
|
|
double _gramWeight = gramWeight.ToDouble2().Value / 1000;
|
|
double area = (widht * height) / 2;
|
|
price = reamPrice / 500;
|
|
tonsPrice = (reamPrice.ToDouble2() / (area.ToDouble2() * (gramWeight.ToDouble2())) * 1000).ToDecimal2();
|
|
tonsPrice = tonsPrice.ToDecimal2();
|
|
reamWeight = (widht * height * _gramWeight * 500).ToDecimal2();
|
|
reamWeight = reamWeight.ToDecimal2();
|
|
reamNumber = (1000 / reamWeight).ToDouble2().Value.ToString("0.00").ToDouble2();
|
}
|
}
|
}
|
else
|
{
|
string[] paperSizes = paperSize.Split('×');
|
|
double widht = paperSizes[0].ToDouble2().Value / 1000;
|
|
double height = paperSizes[1].ToDouble2().Value / 1000;
|
|
double area = (widht * height) / 2;
|
|
price = reamPrice / 500;
|
|
gramWeight = ((reamPrice.ToDouble2() / (tonsPrice.ToDouble2() / 1000)) / area).ToInt32();
|
|
double _gramWeight = gramWeight.ToDouble2().Value / 1000;
|
|
reamWeight = (widht * height * _gramWeight * 500).ToDecimal2();
|
|
reamWeight = reamWeight.ToDecimal2();
|
|
reamNumber = (1000 / reamWeight).ToDouble2().Value.ToString("0.00").ToDouble2();
|
}
|
AllPrice = paperOfQua * price;
|
html = paperSize + "|" + gramWeight.ToDecimal2Yen() + "|" + reamWeight.ToDecimal2Yen() + "|" + reamNumber.ToDecimal2Yen() + "|" + tonsPrice.ToDecimal2Yen() + "|" + reamPrice.ToDecimal2Yen() + "|" + price.ToDecimal2Yen() + "|" + AllPrice.ToDecimal2Yen();
|
return html;
|
}
|
|
}
|
}
|