Ödeme Tarihine Göre Borç Bilgilendirme C#
Ödeme Tarihine Göre Borç Bilgilendirme C#
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
DateTime son_ödeme_tarihi, ödendiği_tarih;
long fiyat=0, fark=0,ceza=0;
try
{
fiyat = long.Parse(textBox2.Text);
son_ödeme_tarihi = DateTime.Parse(textBox3.Text);
ödendiği_tarih = DateTime.Parse(textBox4.Text);
fark = (long)(ödendiği_tarih.ToOADate() - son_ödeme_tarihi.ToOADate());
}
catch(Exception hata)
{
MessageBox.Show("Bilgiler hatalı yazılmış."+hata.Message);
}
if (fark>0)
{
ceza=(fark*fiyat*2)/1000;
textBox5.Text=ceza.ToString("#,#");
textBox6.Text=(fiyat+ceza).ToString("#,#");
MessageBox.Show(fark+ "gün geç ödendi." +textBox5.Text+ "TL ceza ödeyecek.");
}
else
if (fark==0)
{
ceza=0;
textBox5.Text="0";
textBox6.Text=fiyat.ToString("#,#");
MessageBox.Show("Tam Gününde Ödendi");
}
else
{
ceza=1000;
textBox5.Text=ceza.ToString("#,#");
textBox6.Text=(fiyat-ceza).ToString("#,#");
MessageBox.Show(fark + "gün erken ödendi."+ textBox5.Text+ " TL indirimli ödeyecek");
}
}
private void Form1_Load(object sender, EventArgs e)
{
label7.Text = DateTime.Now.ToString();
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Text = " ";
textBox2.Text = " ";
textBox3.Text = " ";
textBox4.Text = " ";
textBox5.Text = " ";
textBox6.Text = " ";
}
private void button3_Click(object sender, EventArgs e)
{
Close();
}
}
}



